开发者

Detecting IE version not considering compatibility mode

开发者 https://www.devze.com 2023-02-01 21:36 出处:网络
I\'m trying to figure out if it\'s possible to detect what version of IE you are using, and not you开发者_JS百科r document-mode. It can be server or client-code (doesn\'t matter), I just need to know

I'm trying to figure out if it's possible to detect what version of IE you are using, and not you开发者_JS百科r 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.


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
0

精彩评论

暂无评论...
验证码 换一张
取 消