我正在为一个在所有内部网站点上强制兼容模式的客户端工作。我想知道是否有一个标签,我可以把我的HTML强制兼容性模式关闭。


当前回答

IE8对外网默认为“标准模式”,内网默认为“怪异模式”。 如果将doctype设置为xhtml transitional,则忽略HTML元标记。 解决方案是在代码中添加HTTP报头。 这对我们很管用。 现在我们的内部网正在强制IE8以标准模式呈现应用程序。

添加到基页类的PageInit (ASP.net c#):

Response.AddHeader("X-UA-Compatible", "IE=EmulateIE8");

参考: http://ilia.ws/archives/196-IE8-X-UA-Compatible-Rant.html

其他回答

如果您正在处理内部网专区中的页面,您可能会发现无论您做什么,IE9都会进入IE7 Compat模式。

这是由于IE兼容性设置中的设置,它说所有的Intranet站点都应该在兼容模式下运行。你可以通过组策略取消勾选(或者只是在IE中取消勾选),或者你可以设置如下:

<meta http-equiv="X-UA-Compatible" content="IE=Edge" />

这是可行的(详见其他答案),但最初可能不是这样的:它需要在样式表声明之前出现。如果你不这样做,它就会被忽略。

IE8对外网默认为“标准模式”,内网默认为“怪异模式”。 如果将doctype设置为xhtml transitional,则忽略HTML元标记。 解决方案是在代码中添加HTTP报头。 这对我们很管用。 现在我们的内部网正在强制IE8以标准模式呈现应用程序。

添加到基页类的PageInit (ASP.net c#):

Response.AddHeader("X-UA-Compatible", "IE=EmulateIE8");

参考: http://ilia.ws/archives/196-IE8-X-UA-Compatible-Rant.html

经过许多小时的故障排除这个东西…以下是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"

插入 作为标签下的第一件物品。

这将迫使IE在IE的物理版本中呈现页面,并忽略浏览器的“模式设置”。这可以在开发人员工具中设置,尝试将其更改为旧版本的IE进行测试,这应该被忽略,页面应该看起来完全相同。

如果你想要每个单独的网页加载所选择的内容,并使用asp.net。只需将其应用为视图>共享>Layout.cshtml中的标题标签下的第一个标签

只是一个小提示