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. 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>
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?
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