javascript 关闭站点的 IE 8 兼容模式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3960120/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Turn off IE 8 Compatibility Mode for site
提问by Queso
My company uses IE8 as the default browser and by default compatibility mode is set for all intranet sites. I'm building an intranet site that works when compatibility mode is turned off. I'm using reset.css and several opensource javascript programs, e.g. datatables.
我公司使用 IE8 作为默认浏览器,并且默认为所有内网站点设置兼容模式。我正在构建一个在兼容模式关闭时工作的 Intranet 站点。我正在使用 reset.css 和几个开源 javascript 程序,例如数据表。
What I'd like to do is force compatibility mode off for my site. Is there any programmatic way to do it? I have tried setting the meta values
我想要做的是为我的网站强制关闭兼容模式。有什么程序化的方法可以做到吗?我试过设置元值
<meta http-equiv="X-UA-Compatible" content="IE=IE8" />
and
和
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
to no avail.
无济于事。
What's the most frustrating part is that Chrome and Firefox work great as is.
最令人沮丧的是 Chrome 和 Firefox 运行良好。
回答by Samuel Neff
The <meta>tag has to be the first tag inside the <head>, other than <title>and other <meta>elements.
该<meta>标签必须是内部的第一标签<head>,比其他<title>及其他<meta>元件。
The X-UA-compatible header is not case sensitive; however, it must appear in the Web page's header (the HEAD section) before all other elements, except for the title element and other meta elements.
X-UA 兼容的标头不区分大小写;但是,它必须出现在网页的标题(HEAD 部分)中的所有其他元素之前,标题元素和其他元元素除外。
http://msdn.microsoft.com/en-us/library/cc288325%28VS.85%29.aspx#DCModes
http://msdn.microsoft.com/en-us/library/cc288325%28VS.85%29.aspx#DCModes
回答by Diodeus - James MacFarlane
These must be the FIRSTmeta tag on your page. Perhaps that's the issue.
这些必须是您页面上的第一个元标记。也许这就是问题所在。

