IE9将网站投入Quirks模式

isp*_*iro 3 asp.net html5 internet-explorer cross-browser internet-explorer-9

我想避免这种情况.我试过了:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
Run Code Online (Sandbox Code Playgroud)

(从HTML5 doctype将IE9置于怪癖模式?)并且:

<meta http-equiv=”X-UA-Compatible” content=”IE=9? />
Run Code Online (Sandbox Code Playgroud)

(来自父框架的禁用怪癖模式)

但没有帮助.当我做F12 - 文档模式IE9标准 - 页面显示正常.

有解决方案吗

Fen*_*ton 5

如果页面是本地页面或Intranet,则Internet Explorer默认为quirks模式.

如果您将相同的页面放在Web上,它将按预期运行.

要使其正常工作,在使用ASP.NET时,可以将其添加到web.config文件中:

<system.webServer>
<httpProtocol>
  <customHeaders>
    <clear />
    <add name="X-UA-Compatible" value="IE=edge" />
  </customHeaders>
</httpProtocol>
Run Code Online (Sandbox Code Playgroud)

这样可以避免必须覆盖所有Intranet页面的用户设置.