3rd-Eden / useragent

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

Android Chrome not detected as mobile_safari #36

Open AlmirKadric opened 10 years ago

AlmirKadric commented 10 years ago

When using chrome from android device, even though 'mobile safari' is in the agent, it's not being parsed for useragent.is['mobile_safari'].

Also, this appears to work fine in useragent.parse as the family is Chrome Mobile. Some data below:

Mozilla/5.0 (Linux; Android 4.1.2; SC-06D Build/JZO54K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.92 Mobile Safari/537.36

useragent.is = { chrome: true, firefox: false, ie: false, mobile_safari: false, mozilla: false, opera: false, safari: false, webkit: true, version: '537.36' }

useragent.parse.family = family: Chrome Mobile

AlmirKadric commented 10 years ago

I found this to apply to safari on iPhone when you create a home screen icon. Data as follows:

Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B329

useragent.is { chrome: false, firefox: false, ie: false, mobile_safari: false, mozilla: false, opera: false, safari: false, webkit: true, version: '536.26' }

useragent.parse { family: 'Mobile Safari', major: '6', minor: '3', patch: '0', source: 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B329' }

3rd-Eden commented 10 years ago

It's not really a mobile safari but a mobile chrome. It might make more sense to introduce a mobile_chrome property instead. Or a mobile flag so you can check that instead.

AlmirKadric commented 10 years ago

yeah that makes sense, however the second example is a mobile safari user agent and should be treated as such.

Will see if I can find the time to PR a fix for this.