ua-parser-js icon indicating copy to clipboard operation
ua-parser-js copied to clipboard

Detect "Chrome Mobile" & "Firefox Mobile"

Open shaharmor opened this issue 6 years ago • 7 comments

Fixes #248

Breaking Change: Firefox on iOS will now be detected as "Firefox Mobile" and not "Firefox"

shaharmor avatar Jul 02 '17 13:07 shaharmor

it would be nice to have this change 👍

aaarichter avatar Mar 02 '18 00:03 aaarichter

@faisalman Why not marge to master? tested and works well adds good value

mercuryyy avatar Jul 25 '18 00:07 mercuryyy

@mercuryyy because this update introduce a breaking change, I'm worried that it will affect existing code for people that still use if (browser.name == "Firefox" && os.name == "iOS") and expect the result to be true. Thus, If I merge this change, it should be in version 0.8.x or later.. Besides that, I'm still considering whether to add Mobile suffix or not.. :thinking:

faisalman avatar Sep 08 '18 09:09 faisalman

@faisalman bump. Any chance to get this merged?

shaharmor avatar Aug 04 '21 12:08 shaharmor

@shaharmor why not to just use the device.type === 'mobile' (or tablet) and if true, assume that the browser is mobile? This change will break the code which relies on something like if (browser.name == 'Chrome') { /* do some chrome specific stuff */ }

Blaumaus avatar Aug 05 '21 21:08 Blaumaus

why not to just use the device.type === 'mobile' (or tablet)

Because the device.type detection is based on the device itself, not the browser, which can sometimes be detected as undefined if the device was not added to the parser yet. The browser UA is specifically listed here which we can utilize to parse "Chrome Mobile" correctly regardless of the device.

I understand its a breaking change, but I suggested it more than 4 years ago, so I'm not sure when is a breaking change going to happen if at all.

shaharmor avatar Aug 17 '21 08:08 shaharmor

5 years later, still a bug :smile:

shaharmor avatar Jan 24 '22 21:01 shaharmor