Detecting IE version not considering compatibility

2019-07-13 05:29发布

I'm trying to figure out if it's possible to detect what version of IE you are using, and not your document-mode. It can be server or client-code (doesn't matter), I just need to know what version of IE the user has installed.

1条回答
Juvenile、少年°
2楼-- · 2019-07-13 05:50

It could be detected in both, by examining the User-Agent string. Note that browsers can spoof their UA string, but this is rarer now than in the past. See this article on MSDN for older UA strings.

Note also that IE8 sends a different UA string in Compatibility mode and in Standards mode (see this and this - both are IE8, although the former says MSIE 7.0).

See this for a long list of UA strings - note that you should be looking for a pattern, not exact match, as installed software will modify the UA string.

IE9 has some new UA string thing - see the IEBlog for details.

To summarize (and borrow from @EricLaw's comment):

  • no Trident in UA string - check the MSIE [0-9].0 string for version
  • Trident/4.0 - IE 8, version in MSIE is not relevant
  • Trident/5.0 - IE 9
查看更多
登录 后发表回答