ua-parser-js
ua-parser-js copied to clipboard
Detect "Chrome Mobile" & "Firefox Mobile"
Fixes #248
Breaking Change: Firefox on iOS will now be detected as "Firefox Mobile" and not "Firefox"
it would be nice to have this change 👍
@faisalman Why not marge to master? tested and works well adds good value
@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 bump. Any chance to get this merged?
@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 */ }
why not to just use the
device.type === 'mobile'
(ortablet
)
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.
5 years later, still a bug :smile: