小编jca*_*ney的帖子

X-UA兼容的http标头是否真的适用于IE9?

我正在开发一个可以作为Intranet站点托管的Web产品.我试图找到一种程序化的方法来防止IE9滑入IE9兼容性视图浏览器模式,即使"在兼容性视图中显示Intranet站点"可能已启用.

我正在测试这个html页面:

<!DOCTYPE HTML>

<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=9" />
        <title>Company</title>
    </head>
    <body>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

我把它放在IIS配置中:

<system.webServer>
    <httpProtocol>
        <customHeaders>
            <clear />
            <add name="X-UA-Compatible" value="IE=edge" />
        </customHeaders>
    </httpProtocol>
Run Code Online (Sandbox Code Playgroud)

按照此处的建议:https://stackoverflow.com/a/5887546,并检查IE9中的响应标头,并查看:

X-UA-Compatible     IE=Edge
Run Code Online (Sandbox Code Playgroud)

但该页面仍然将浏览器置于兼容性视图浏览器模式.

控制台显示:

HTML1202: http://intranet-site/test.html is running in Compatibility View because 'Display intranet sites in Compatibility View' is checked. 
test.html
Run Code Online (Sandbox Code Playgroud)

这里有一个类似的问题:https://stackoverflow.com/a/372​​6605/1279516,其中Jacob对所选答案的评论表明,在IE9中,你无法覆盖"在兼容性视图中显示Intranet网站" ' 设置.但是,他的评论是我发现的唯一提到这一点的地方.任何人都可以确认或否认这种说法吗?

还有什么我可以尝试的吗?我不应该告诉所有部署我们产品的客户取消选中所有用户的"在兼容性视图中显示Intranet网站"浏览器设置.

html browser doctype internet-explorer-9

5
推荐指数
1
解决办法
5811
查看次数

标签 统计

browser ×1

doctype ×1

html ×1

internet-explorer-9 ×1