-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Extend mobile browser detection #2440
Extend mobile browser detection #2440
Conversation
One thing I question is whether the tests should really be case-insensitive. I would lean towards them not being. Maybe it doesn't make much difference. |
if /iP(od|hone)/i.test(window.navigator.userAgent) | ||
return false | ||
if /Android/i.test(window.navigator.userAgent) | ||
return false if /Mobile/i.test(window.navigator.userAgent) | ||
if /IEMobile/i.test(navigator.userAgent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you're missing a window.
on all of these conditions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would still work, would it not? window being the global object and all. But I'll add it for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced the commit.
This looks good to me, but hopefully we can get a 👍 from a more qualified @harvesthq/chosen-developers -- maybe @koenpunt if we're lucky? |
I'm not aware of the actual user agent strings, but this seems good to me |
Extend mobile browser detection
Thanks @tremby and @StephKoenig (and @koenpunt)! |
On top of the existing detections of Android and IOS, detect Windows Phone, IE Mobile, Blackberry and BB10.
As discussed in #1848 and #2439