Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser::isMac() does not seem to work on some UA with iPad/iPod/iPhone in it #195

Open
darkylmnx opened this issue Nov 26, 2022 · 2 comments

Comments

@darkylmnx
Copy link

I have some UA that were iPhone's or iPad's but that were reported false with ìsMac`.

Eg:

  • Mozilla/5.0 (iPad; CPU OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Mobile/15E148 Safari/604.1
  • Mozilla/5.0 (iPad; CPU OS 14_8_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1

Both of these aren't working while despite the following working and having the same signature :

  • Mozilla/5.0 (iPad; CPU OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G36 Safari/601.1

Any idea what's going wrong?

@hisorange
Copy link
Owner

Yep, but technically it's not MacOS, even tho it seems a bit of. But the iPhone runs iOS and iPad runs iPadOS, MacOS is used on laptops and desktops only.

I know the text includes the string, but it would be better to test for "isAppleOS", gonna keep this open for the next minor release, as I see the use case for it.

@nekromoff
Copy link

https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent

Serving different Web pages or services to different browsers is usually a bad idea.
Note: It's worth re-iterating: it's very rarely a good idea to use user agent sniffing. You can almost always find a better, more broadly compatible way to solve your problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants