Html 这会做什么:<meta http-equiv="X-UA-Compatible" content="IE=edge">?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22501453/
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
What will this do: <meta http-equiv="X-UA-Compatible" content="IE=edge">?
提问by user3355705
What will this following tag will do to my browser when a HTML page is loaded?
加载 HTML 页面时,以下标记将对我的浏览器执行什么操作?
<meta http-equiv="X-UA-Compatible" content="IE=edge">
回答by RobIII
http://msdn.microsoft.com/en-us/library/jj676915(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/jj676915(v=vs.85).aspx
Understanding legacy document modes
Use the following value to display the webpage in edge mode, which is the highest standards mode supported by Internet Explorer, from Internet Explorer 6 through IE11.
<meta http-equiv="x-ua-compatible" content="IE=edge">
Note that this is functionally equivalent to using the HTML5 doctype. It places Internet Explorer into the highest supported document mode. Edge most is most useful for regularly maintained websites that are routinely tested for interoperability between multiple browsers, including Internet Explorer.
NoteStarting with IE11, edge mode is considered the preferred document mode. (In earlier versions, it was considered experimental.) To learn more, see Document modes are deprecated. Starting with Windows Internet Explorer 8, some web developers used the edge mode meta element to hide the Compatibility View button on the address bar. As of IE11, this is no longer necessary as the button has been removed from the address bar. Because it forces all pages to be opened in standards mode, regardless of the version of Internet Explorer, you might be tempted to use edge mode for all pages viewed with Internet Explorer. Don't do this, as the X-UA-Compatible header is only supported starting with Internet Explorer 8.
TipIf you want all supported versions of Internet Explorer to open your pages in standards mode, use the HTML5 document type declaration, as shown in the earlier example.
了解旧文档模式
使用以下值以边缘模式显示网页,这是 Internet Explorer 支持的最高标准模式,从 Internet Explorer 6 到 IE11。
<meta http-equiv="x-ua-compatible" content="IE=edge">
请注意,这在功能上等同于使用 HTML5 文档类型。它将 Internet Explorer 置于最高支持的文档模式。Edge most 对于定期维护的网站最有用,这些网站经常测试多个浏览器(包括 Internet Explorer)之间的互操作性。
注意从 IE11 开始,边缘模式被视为首选文档模式。(在早期版本中,它被认为是实验性的。)要了解更多信息,请参阅文档模式已弃用。从 Windows Internet Explorer 8 开始,一些 Web 开发人员使用边缘模式元元素来隐藏地址栏上的兼容性视图按钮。从 IE11 开始,这不再是必需的,因为该按钮已从地址栏中删除。因为它强制所有页面都以标准模式打开,而不管 Internet Explorer 的版本如何,所以您可能想对使用 Internet Explorer 查看的所有页面使用边缘模式。不要这样做,因为 X-UA-Compatible 标头仅从 Internet Explorer 8 开始支持。
提示如果您希望所有受支持的 Internet Explorer 版本都以标准模式打开您的页面,请使用 HTML5 文档类型声明,如前面的示例所示。