3rd-Eden / useragent

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

iOS Safari 10 minor versions not recognised #177

Open camslice opened 1 year ago

camslice commented 1 year ago

All minor & patch versions of iOS Safari 10 return 0 as the minor version. It is impossible to target minor versions.

For example, the UA string for iOS Safari version 10.1 is:

Mozilla/5.0 (iPhone; CPU iPhone OS 10_1 like Mac OS X) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0 Mobile/14B72 Safari/602.1

If you run lookup() on this string, it will return:

{ name: 'mobileSafari', major: 10, minor: 0, patch: 0 }

Obviously the Version in the UA string is 10.0, however on iOS the version of Safari always matches the version of the OS. If you update iOS, the Safari version is also updated. For some reason iOS Safari UI strings don't have the minor version updated in the Version section, so you need to consider the OS minor and patch versions.

Please see this RunKit for a demonstration with more examples: https://runkit.com/camslice/ios-safari-10-minor-versions-not-recognised

camslice commented 1 year ago

FYI @3rd-Eden I came across this issue in another library

There is some confusion around iOS Safari versions, because the only "official" way according to Apple to check which version of iOS Safari is installed, is to refer to the operating system version. This implies that there are iOS Safari versions to match all major, minor and patch releases of the operating system, for example:

However, if you refer to these two links, it appears that there are far fewer distinct Safari releases and they are in fact tied to the Webkit version, not the OS version. According to these links, iOS Safari v10.3 does not exists:

There is also some interesting reading on this StackExchange answer

Let me know your thoughts, thanks.