3rd-Eden / useragent

Useragent parser for Node.js, ported from browserscope.org
MIT License
897 stars 137 forks source link

Stock Samsung Browser on Android devices misreported as "Chrome Mobile" #85

Closed guifromrio closed 8 years ago

guifromrio commented 8 years ago

Hi, there.

As initially reported over at https://github.com/Financial-Times/polyfill-service/issues/509, some Samsung Browser ("Internet" app) user agents are being recognised as "Chrome Mobile" by useragent.

Example UA: Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-G920F Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.2 Chrome/38.0.2125.102 Mobile Safari/537.36

> ua.parse('Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-G920F Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.2 Chrome/38.0.2125.102 Mobile Safari/537.36')
Agent {
  family: 'Chrome Mobile',
  major: '38',
  minor: '0',
  patch: '2125',
  source: 'Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-G920F Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.2 Chrome/38.0.2125.102 Mobile Safari/537.36' }

This is a problem because they do not behave as Chrome Mobile. For example, in this particular case this browser does not implement the Intl global object.

However, I'm not sure how to propose a fix in this scenario. Would you agree to create a new "Family Name" specifically for Samsung Browser? I'm happy to provide a PR once I know what form the fix should take.

3rd-Eden commented 8 years ago

The module uses a community sourced regexp library to do most of the heavy lifting so it can be shared between different langauges. So if new regexp's need to be written they need to be added to this project.

Having that said, there is already an pull request for this browser: https://github.com/ua-parser/uap-core/pull/123/files so once it's pulled it will work as intended.

3rd-Eden commented 8 years ago

Now that the pull request is finally merged upstream.. I released a new patch version of useragent with a new compilation of the parsers. Should be available in npm now.