3rd-Eden / useragent

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

IE9 user agent is shown as IE11 #136

Open muralikr opened 5 years ago

muralikr commented 5 years ago
Agent {
  family: 'IE',
  major: '11',
  minor: '0',
  patch: '0',
  source: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/7.0' }
ZB-Block-JamesC commented 4 years ago

Trident/7.0 is the rendering engine for IE11. https://en.wikipedia.org/wiki/Trident_(software)#Release_history

IE11 Compatibility Mode will present legacy UAs to sites that expect a previous IE (or in some cases, Firefox or Chrome UAs): https://iecvlist.microsoft.com/IE11/1375395130872/iecompatviewlist.xml

Within the Compatibility Mode file for Windows 10, we find: IE11: Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko IE9: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)

The Trident/7.0 token indicates IE11, but IE doesn't use the MSIE token, it uses a Firefox-style rv:11.0 token. MSIE 9.0 uses a Trident/5.0 token.

Long story short, the source UA (in muralikr's post above) is not a legitimate IE user-agent string for either IE9 or IE11. Ideally we'd report this as an invalid match ("Other" or "Invalid" or similar), but if we must identify it as either IE9 or IE11, we have a >50% chance of being wrong. :(