这可能吗?我尝试将其添加到页面,但它没有改变任何事情。
<meta http-equiv="X-UA-Compatible" content="IE=8">
更新 - 我正在尝试这样做,因为我们的网站有一些 IE9 特定的 CSS 问题,这些问题不会出现在 IE8 中。
谢谢
这可能吗?我尝试将其添加到页面,但它没有改变任何事情。
<meta http-equiv="X-UA-Compatible" content="IE=8">
更新 - 我正在尝试这样做,因为我们的网站有一些 IE9 特定的 CSS 问题,这些问题不会出现在 IE8 中。
谢谢
您可以使用文档兼容模式来执行此操作,这正是您尝试的方式。但是,需要注意的是:它必须出现在网页的标题(HEAD 部分)中,位于所有其他元素之前,除了标题元素和其他元元素希望是问题所在。此外,兼容 X-UA 的标头不区分大小写请参阅:http: //msdn.microsoft.com/en-us/library/cc288325%28v=vs.85%29 .aspx#SetMode
编辑:万一发生什么事情会杀死 msdn 链接,这里是内容:
指定文档兼容模式
您可以使用文档模式来控制 Internet Explorer 解释和显示您的网页的方式。要为您的网页指定特定的文档模式,请使用 meta 元素在您的网页中包含 X-UA-Compatible 标头,如以下示例所示。
<html> <head> <!-- Enable IE9 Standards mode --> <meta http-equiv="X-UA-Compatible" content="IE=9" > <title>My webpage</title> </head> <body> <p>Content goes here.</p> </body> </html>
如果您在 Internet Explorer 9 中查看此网页,它将以 IE9 模式显示。
以下示例指定 EmulateIE7 模式。
<html> <head> <!-- Mimic Internet Explorer 7 --> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" > <title>My webpage</title> </head> <body> <p>Content goes here.</p> </body> </html>
在此示例中,X-UA-Compatible 标头指示 Internet Explorer 在确定如何显示网页时模仿 Internet Explorer 7 的行为。这意味着 Internet Explorer 将使用该指令(或缺少该指令)来选择适当的文档类型。由于此页面不包含指令,因此示例将以 IE5 (Quirks) 模式显示。
是的。最新版本的 IE(IE8 或更高版本)可让您进行调整。就是这样:
这应该会打开开发者工具窗口。该窗口有两个感兴趣的菜单项:
更多信息请访问http://blogs.msdn.com/b/ie/archive/2010/06/16/ie-s-compatibility-features-for-site-developers.aspx
The 1st element as in no hard returns. A hard return I guess = an empty node/element in the DOM which becomes the 1st element disabling the doc compatability meta tag.
On the client side you can add and remove websites to be displayed in Compatibility View from Compatibility View Settings window of IE:
Tools-> Compatibility View Settings