开发者

Why user agent change in IE9 with browser mode IE9 <F12 developer tools>?

The code is

<html>
<body>
<script type="text/javascript">
    document.write("<p>UserAgent: ")
    document.write(navigator.userAgent + "</p>")
</script>
</body>
</html> 

Save it as html file and open it in IE9. You will see FULL user agent is shown.

But, if you press F12 to open developer tools, then re-select browser mode as 'IE9' (even current browser mode is IE9), SHORT user agent is shown.

Why?

开发者_JS百科Big Thanks!


Fascinating. I believe that's a bug in the developer tools. The "short" UA string is only supposed to be sent to the server in IE9 standards mode. It's not meant to appear to JavaScript, regardless of document mode.

http://blogs.msdn.com/b/ie/archive/2010/03/23/introducing-ie9-s-user-agent-string.aspx

I suspect the problem here is that the way that the Developer Tools are trying to set the UA string (for emulation purposes) impacts that local JavaScript UA String as well.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜