I am using the Flot plotting library. It seems to work fine in IE8 and IE9 but the problem comes when in IE9 Compatibility View – it does not render any of the graphs. I suspect this is because of the HTML5 canvas object it uses heavily but I could be wrong. I tried doing the following:
-
Add:
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />to my HTML<head></head>tag. I even triedIE=8andIE=9and that did not help either. My tag look like this:<!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> -
Because I was still seeing the problem, I added the following to my Global.asax.cs file:
void Application_End(object sender, EventArgs e) { // Code that runs on application shutdown Response.Headers.Add("X-UA-Compatible", "IE=Edge"); }
I am still facing the problem. The error I get is this:
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
Is there anyway to over ride this?
EDIT: Checking my response headers, adding that line in Global.asax.cs did not add them to my headers. I wonder why.
Response Headers:
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
EDIT 2: Apparently, Application_End was the wrong event. Instead, doing this injected the element into the header:
void Application_BeginRequest(object sender, EventArgs e)
{
Response.Headers.Add("X-UA-Compatible", "IE=Edge");
}
But the problem itself still persists.
The problem may be due to your Internet Explorer compatibility view settings. If you go to the “Tools” menu, then to “Compatibility View Settings”, make sure that “Display intranet sites in Compatibility View” is not checked. You may be seeing IE force you into compatibility view based on your hostname being detected as being in your intranet.
Note that – depending on your version of IE – you might have to press the left Alt key for the menubar to appear, from where the “Tools” menu can be opened.