我正在为一个在所有内部网站点上强制兼容模式的客户端工作。我想知道是否有一个标签,我可以把我的HTML强制兼容性模式关闭。
当前回答
在回答相关问题时,建议在Web中设置“边缘”模式。配置文件。这将使它适用于从应用程序返回的所有HTML,而不需要将它插入到单个页面:
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-UA-Compatible" value="IE=edge" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
同样的步骤也可以通过使用IIS管理器为IIS服务器、整个网站或特定应用程序修改“HTTP响应头”来完成。
其他回答
经过许多小时的故障排除这个东西…以下是x - ua兼容文档中的一些快速重点内容:http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx#ctl00_contentContainer_ctl16
使用<meta http-equiv="X-UA-Compatible" content=" _______ " />
The Standard User Agent modes (the non-emulate ones) ignore <!DOCTYPE> directives in your page and render based on the standards supported by that version of IE (e.g., IE=8 will better obey table border spacing and some pseudo selectors than IE=7). Whereas, the Emulate modes tell IE to follow any <!DOCTYPE> directives in your page, rendering standards mode based the version you choose and quirks mode based on IE=5 Possible values for the content attribute are: content="IE=5" content="IE=7" content="IE=EmulateIE7" content="IE=8" content="IE=EmulateIE8" content="IE=9" content="IE=EmulateIE9" content="IE=edge"
元标签解决方案并不适合我们,但在响应头中设置它却可以:
header('X-UA-Compatible: IE=edge,chrome=1');
如果您正在处理内部网专区中的页面,您可能会发现无论您做什么,IE9都会进入IE7 Compat模式。
这是由于IE兼容性设置中的设置,它说所有的Intranet站点都应该在兼容模式下运行。你可以通过组策略取消勾选(或者只是在IE中取消勾选),或者你可以设置如下:
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
这是可行的(详见其他答案),但最初可能不是这样的:它需要在样式表声明之前出现。如果你不这样做,它就会被忽略。
如果你想要每个单独的网页加载所选择的内容,并使用asp.net。只需将其应用为视图>共享>Layout.cshtml中的标题标签下的第一个标签
只是一个小提示
在回答相关问题时,建议在Web中设置“边缘”模式。配置文件。这将使它适用于从应用程序返回的所有HTML,而不需要将它插入到单个页面:
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-UA-Compatible" value="IE=edge" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
同样的步骤也可以通过使用IIS管理器为IIS服务器、整个网站或特定应用程序修改“HTTP响应头”来完成。