Question

I am trying to implement a browser support feature on my webpage. For Firefox 3.6 it is working fine, but for some reason IE 8's userAgent is returning a wrong value.

Here is the scenario, when I run a 'local' javascript code on IE8, navigator.userAgent returns correct information (MSIE 8.0). But when I run this script on a server, it returns MSIE 7.0 on an IE 8 browser.

Any ideas?

Était-ce utile?

La solution

Microsoft provides this page:

http://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx

According to the Javascript sample one would think IE8 would return an 8, not a 7.

Autres conseils

You need to check Trident token too.

Trident token

When the F12 developer tools are used to change the browser mode of Internet Explorer, the version token of the user-agent string is modified to appear so that the browser appears to be an earlier version. This is done to allow browser specific content to be served to Internet Explorer and is usually necessary only when websites have not been updated to reflect current versions of the browser.

When this happens, a Trident token is added to the user-agent string. This token includes a version number that enables you to identify the version of the browser, regardless of the current browser mode.

MORE : http://msdn.microsoft.com/en-us/library/ms537503.aspx

Are you sure you aren't running in IE7 mode? You can change it somewhere in the Developer settings (F12, I think).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top