php-browser-detection icon indicating copy to clipboard operation
php-browser-detection copied to clipboard

macOS Monterey not working

Open maisen20 opened this issue 2 years ago • 11 comments

Hi,

as the title says, it's not detecting macOS Monterey. I have installed macOS Monterey today and it still detect my system as macOS Big Sur.

Best regards maisen20

maisen20 avatar Oct 26 '21 06:10 maisen20

Hi,

Here is macOS Monterey user-agents examples and it's detectable correctly by latest library version:

Mozilla/5.0 (Macintosh; Intel Mac OS X 12_0_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36 Mozilla/5.0 (Macintosh; Intel Mac OS X 12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36 Mozilla/5.0 (Macintosh; Intel Mac OS X 12.0; rv:93.0) Gecko/20100101 Firefox/93.0 Mozilla/5.0 (Macintosh; Intel Mac OS X 12_0_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15

Can you send me wrong detectable user-agent to make appropriate tests?

foroco avatar Oct 28 '21 20:10 foroco

Hi foroco

Thank you for your fast answer =).

My Infos:

macOS Monterey Version 12.0.1

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15

Browser detection: Array ( [os_type] => desktop [os_family] => macintosh [os_name] => MacOS [os_version] => Big Sur [os_title] => MacOS Big Sur [64bits_mode] => 1 )

maisen20 avatar Oct 29 '21 05:10 maisen20

Hi, @maisen20

Unfortunately, I have no idea why your Safari 15 browser on macOS Monterey release sends User-Agent as Big Sur release. Because '10_15_7' substring in part of your User-Agent always denotes Big Sur release (according to 'major', 'minor' and 'release' numbers).

I think it's a User-Agent bug in Safari v.15.

Nevertheless, I will continue to try to investigate this issue.

foroco avatar Oct 29 '21 21:10 foroco

@foroco, for your working case, what browser version are you using? I'm surprised there is a working browser version for detecting Monterey.

Please refer to these for context:

https://www.otsukare.info/2021/02/15/capping-macos-user-agent https://help.duo.com/s/article/6627?language=en_US https://developer.apple.com/forums/thread/666209

with Big Sur onwards, it is expected that the user agent string may not be accurate for reporting actual OS.

the way forward for new OSes is to detect using client hints API for browsers that support it:

https://web.dev/user-agent-client-hints/ https://browserleaks.com/client-hints

The new API doesn't work for all browsers yet. So until the world catches up, the detection for new OSes is best effort.

I wonder if the current Big Sur detection is also accurate, as the issue started/broke with Big Sur, for the newer releases of Big Sur.

daluu avatar Feb 25 '22 20:02 daluu

The same thing happens to me in Chrome, Safari, Firefox, Opera...

macOS Monterey Version 12.4 M1 processor

( I don't know if @daluu also uses M1 or Intel ) ( Just in case it helps, I use "getAll" )

Chrome Versión 102.0.5005.115 (Build oficial) (arm64): Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36

Safari Versión 15.5 (17613.2.7.1.8): Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15

Firefox 101.0.1 (64-bit): Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0) Gecko/20100101 Firefox/101.0

Opera 88.0.4412.40 (arm64): Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.115 Safari/537.36 OPR/88.0.4412.40

DigitalAndSEO avatar Jun 21 '22 16:06 DigitalAndSEO

Hi,

@daluu Thanks for the links, which show the actuality of the problem.

Unfortunately, after releasing MacOS Big Sur, the OS vendor "froze" the OS User Agent information at that release level.

New MacOS releases no longer send actual OS version information to browsers (tested on WebKit, Chromium, and Gecko-based browser engines).

One solution is to use the User-Agent Client Hints API information on the client side (API information provided by Chromium-based browsers).

foroco avatar Mar 10 '23 19:03 foroco

I think the server side (PHP) may be able to pull the client hints info, it just requires some extra logic and redirection on the server side perhaps plus maybe some inclusion of client side logic as needed. Because the client hints API between client & server is about server requesting additional info from client (via server HTTP response headers to client's initial hit on the server) and client responding to that server "request" in subsequent HTTP/webpage request, sending them in HTTP request headers, server can then parse those new data. This is only if the browser client supports client hints of course.

https://wicg.github.io/ua-client-hints/#examples https://developer.chrome.com/articles/user-agent-client-hints/#example-exchange

So maybe this project could be extended to offer best effort client hints detection of new OS/browser info? Whether in this main project repo or in a 3rd party project/fork.

daluu avatar Mar 10 '23 22:03 daluu

( I don't know if @daluu also uses M1 or Intel )

I don't think actual platform/hardware matters for this particular issue. It's all about the OS version that impacts the issue, not even the browser.

daluu avatar Mar 10 '23 22:03 daluu

I did some tests with client hints. At the moment it's not possible to detect the MacOS version via client hints in the common browsers.

foroco avatar Apr 27 '23 14:04 foroco

Here is macOS Monterey user-agents examples and it's detectable correctly by latest library version:

Mozilla/5.0 (Macintosh; Intel Mac OS X 12_0_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36 Mozilla/5.0 (Macintosh; Intel Mac OS X 12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36 Mozilla/5.0 (Macintosh; Intel Mac OS X 12.0; rv:93.0) Gecko/20100101 Firefox/93.0 Mozilla/5.0 (Macintosh; Intel Mac OS X 12_0_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15

I'm still curious, @foroco, if you recall where that user agent string came from. Which browser? That string seems to be an anomaly compared to what most of us observe for browsers these days. It would be nice to know for reference, for all of us. Or was that taken from logs received for users that visit the site/page, etc.?

daluu avatar Apr 27 '23 16:04 daluu

oh, nevermind, I see in the user agent and pasting it in a UA parser it is FF 93. I guess that was a version before FF locked down the OS reporting.

daluu avatar Apr 27 '23 17:04 daluu