X-UA-兼容于IE 9不工作的Intranet站点 [英] X-UA-Compatible not working in IE 9 for intranet sites

查看:183
本文介绍了X-UA-兼容于IE 9不工作的Intranet站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在做一个内部网站与asp.net的MVC 5,但与兼容性设置的一些问题在IE 9的现场需要,而不兼容性视图来显示。结果
我们做了一些研究,做这些:结果
1. layout.cshtml加元和login.cshtml

we're making an intranet site with asp.net mvc 5, but have some issues with compatibility setting in IE 9. The site need to be displayed without compatibility view.
We did some research, and do these:
1. add meta in layout.cshtml and login.cshtml

<!DOCTYPE html>
<html>
<head>
    <title>@System.Web.Configuration.WebConfigurationManager.AppSettings["WebsiteTitle"]</title>
    <meta http-equiv='X-UA-Compatible' content='IE=Edge'>
    <meta http-equiv="PRAGMA" content="NO-CACHE">
    ....

@{Layout = null;}
@model ZdtcWebsite.Models.LoginModel
<!DOCTYPE html>
     <html>
     <head>
     <title>@System.Web.Configuration.WebConfigurationManager.AppSettings["WebsiteTitle"]</title>
     <meta http-equiv='X-UA-Compatible' content='IE=Edge'>
     <meta http-equiv="PRAGMA" content="NO-CACHE">
     <meta charset="utf-8" />
     ....

2。我们增加在web.config中customheader

2. We add customheader in web.config

<system.webServer>
<httpProtocol> 
        <customHeaders> 
          <clear />
          <add name="X-UA-Compatible" value="IE=Edge" /> 
        </customHeaders> 
     </httpProtocol> 
<validation validateIntegratedModeConfiguration="false" />
</system.webServer> 

双方这仍然没有工作。打开时,我们的网站依然会在兼容模式下。
有一件事我注意到的是,如果我们打开在IE9的开发工具和打开网页时,X-UA兼容标签的工作,但如果开发者工具关闭。结果
我们在IE浏览器11测试这和它工作正常。任何人都可以表明这里发生了什么?

Both of this still not working. Our site will still come in compatibility mode when opened. One thing that I notice is that if we open developer tools in IE9 and open the page, the X-UA-Compatible tag is working, but not if developer tools is closed.
We test this on IE 11 and it works fine. Anybody can suggest what's happening here?

推荐答案

原来,这是因为我们在我们的脚本有几个的console.log。当我们删除该网站工作正常。这可能也是为什么如果开发工具是表明该网站能正常工作的原因。我不明白为什么会出现的console.log和兼容性视图之间的任何联系,但是我想有

Turns out it is because we have several "console.log" in our script. When we remove them the site works fine. That's probably also the cause why the site works fine if developer tools is showed. I don't understand why there is any connection between console.log and compatibility view, but I guess there are

这篇关于X-UA-兼容于IE 9不工作的Intranet站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆