简体   繁体   English

IE忽略响应头中的X-UA兼容IE =边缘

[英]IE ignores X-UA-Compatible IE=edge in response header

I have a issue regarding the compatibility mode with IE10 and IE11. 关于与IE10和IE11的兼容模式,我有一个问题。 As mentioned in other questions here, adding this to the web.config will solve the problem with IE rendering the page in compatibility mode in intranet: 正如其他问题所述,将此添加到web.config将解决IE在Intranet中以兼容模式呈现页面的问题:

<httpProtocol>
   <customHeaders>
      <add name="X-UA-Compatible" value="IE=edge" />
   </customHeaders>
</httpProtocol>

The doctype is doctype是

<!DOCTYPE html> 

This worked for some time, but now it won't work. 这工作了一段时间,但现在它不起作用。 The response header correctly contains this information (X-UA-Compatible IE=edge), IE11 for example runs in EDGE mode, but the user agent is 响应头正确包含此信息(X-UA-Compatible IE = edge),IE11例如在EDGE模式下运行,但用户代理是

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729) Mozilla / 4.0(兼容; MSIE 7.0; Windows NT 6.3; WOW64; Trident / 7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729)

This incorrect user agent causes the pages to behave incorrectly. 此不正确的用户代理会导致页面行为不正确。 What could be the cause for the incorrect user agent? 错误的用户代理可能是什么原因? The compatibility mode for intranet sites was always enabled, even back then when it worked. Intranet站点的兼容模式始终启用,即使在它工作时也是如此。

Possible things to look at: 可能需要注意的事项:

  1. The code you've shown is for the http header; 您显示的代码是http标头; you might be setting the X-UA-Compatible flag in the meta tags as well and overriding the http header. 您可能也在元标记中设置X-UA-Compatible标记并覆盖http标头。 Check by viewing your HTML source. 通过查看HTML源来检查。

  2. If you're seeing this issue on your local network, it might be because of your browser settings; 如果您在本地网络上看到此问题,可能是因为您的浏览器设置; there is an IE config setting that explicitly tells it to always fall into compatibility mode when browsing sites on the local network, regardless of any X-UA-Compatible headers your page may send. 有一个IE配置设置明确告诉它在浏览本地网络上的站点时始终处于兼容模式,无论您的页面可能发送任何X-UA-Compatible标头。 This setting defaults to being switched ON. 此设置默认为开启。 Go to the browser config and switch it off. 转到浏览器配置并将其关闭。 I think this is the most likely cause. 我认为这是最可能的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM