似乎无法摆脱兼容性视图?

Leg*_*end 18 c# asp.net html5 internet-explorer http

我正在使用Flot绘图库.它似乎在IE8和IE9中工作正常,但问题出现在IE9兼容性视图中 - 它不呈现任何图形.我怀疑这是因为canvas它大量使用的HTML5 对象,但我可能是错的.我尝试过以下操作:

  • 添加:<meta http-equiv="X-UA-Compatible" content="IE=Edge" />到我的HTML <head></head>标记.我甚至尝试过IE=8,IE=9但这也没有帮助.我的标签看起来像这样:

    <!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.1EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <meta http-equiv="X-UA-Compatible" content="IE=8" />
        ...
    </head>
    <body>
    ...
    </body>
    </html>
    
    Run Code Online (Sandbox Code Playgroud)
  • 因为我仍然看到问题,我将以下内容添加到我的Global.asax.cs文件中:

    void Application_End(object sender, EventArgs e)
    {
        //  Code that runs on application shutdown
        Response.Headers.Add("X-UA-Compatible", "IE=Edge");
    }
    
    Run Code Online (Sandbox Code Playgroud)

我仍然面临着这个问题.我得到的错误是这样的:

HTML1202: http://intranetdomain/SampleProj/Default.aspx is running in Compatibility View because 'Display intranet sites in Compatibility View' is checked. 
Default.aspx
HTML1113: Document mode restart from IE7 Standards to IE9 Standards 
Default.aspx
Run Code Online (Sandbox Code Playgroud)

反正过来骑这个吗?

编辑:检查我的响应标题,添加该行Global.asax.cs没有将它们添加到我的标题.我想知道为什么.

响应标题:

Key Value
Response    HTTP/1.1 200 OK
Cache-Control   private
Content-Type    text/html; charset=utf-8
Server  Microsoft-IIS/7.5
X-AspNet-Version    4.0.30319
X-Powered-By    ASP.NET
Date    Thu, 27 Oct 2011 20:39:55 GMT
Content-Length  29088
Run Code Online (Sandbox Code Playgroud)

编辑2:显然,Application_End是错误的事件.相反,这样做会将元素注入标题:

void Application_BeginRequest(object sender, EventArgs e)
{
    Response.Headers.Add("X-UA-Compatible", "IE=Edge");
}
Run Code Online (Sandbox Code Playgroud)

但问题本身仍然存在.

Jac*_*cob 33

问题可能是由于您的Internet Explorer兼容性视图设置.如果转到"工具"菜单,然后转到"兼容性视图设置",请确保选中"在兼容性视图中显示Intranet站点" .您可能会看到IE根据您的Intranet中检测到的主机名强制您进入兼容性视图.

请注意 - 根据您的IE版本,您可能需要按左键Alt才能显示菜单栏,从中可以打开"工具"菜单.

  • 因为这正是在/ localhost /中工作的Web开发人员想要做的事情 - 默认情况下在IE7模拟中查看他或她的工作.微软布拉沃.继续吃胶水. (5认同)