I am quite confused. I should be able to set
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
and IE8 and IE9 should render the page using the latest rendering engine. However, I just tested it, and if Compatibility Mode is turned on elsewhere on our site, it will stay on for our page, even though we should be forcing it not to.
How are you supposed to make sure IE does not use Compatibility Mode (even in an intranet)?
FWIW, I am using the HTML5 DocType declaration (<!doctype html>
).
Here are the first few lines of the page:
<!doctype html>
<!--[if lt IE 7 ]> <html lang="en" class="innerpage no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="innerpage no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="innerpage no-js ie8"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html lang="en" class="innerpage no-js">
<!--<![endif]-->
<head>
<meta charset="ISO-8859-1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
EDIT: I just learned that the default setting on IE8 is to use IE7 compatibility mode for intranet sites. Would this override the X-UA-Compatible meta tag?
I was experiencing the same issue in IE11. None of these answers solved my issue. After digging a bit, I noticed that the browser was running in Enterprise mode. (verify by hitting F12 and click the emulation tab, look for browser profile dropdown) The setting was locked, not allowing me to change the setting.
I was able to change the profile to Desktop after deleting CurrentVersion from the following registry key:
After changing the mode to Desktop the answers on this post will work.
IE 11 doesn't allow you to override the browser compatibility view setting anymore by sending the header...
It appears the only way to force the browser to not use compatibility view is to have the user disable it in their browser. Ours is an Intranet site, and the default IE option is to use compatibility view for Intranet sites. What a pain!
We were able to prevent the need for the user to change their browser settings for users of IE 9 and 10, but it no longer works in IE 11. Our IE users are switching to Chrome, where this is not a problem, and never has been.
Server Side solution is the recommended one, as @TimmyFranks proposed in his answer, but if one needs to implement the
X-UA-Compatible
rule on the page level, please read the following tips, to benefit from the experience of the one who already got burnedThe
X-UA-Compatible
meta tag must appear straight after the title in the<head>
element. No other meta tags, css links and js scripts calls can be placed before it.If there are any conditional comments in the page (lets say located in the
<html>
), they must be placed under, after the<head>
.Html5BoilerPlate's team wrote about this bug - http://h5bp.com/i/378 They have several solutions.
Regarding Intranet & Compatibility view, there're settings when you go to tools > Compatibility view settings.
Additionally, X-UA-Compatible must be the first meta tag in the head section
By the way, the correct order or the main head tags are:
This way
Even if you have unchecked the "Display intranet sites in Compatibility View" option, and have the X-UA-Compatible in your response headers, there is another reason why your browser might default to "Compatibility View" anyways - your Group Policy. Look at your console for the following message:
Where xxx.xxx is the domain for your site (i.e. test.com). If you see this then the group policy for your domain is set so that any site ending in test.com will automatically render in Compatibility mode regardless of doctype, headers, etc.
For more information, please see the following link (explains the html codes): http://msdn.microsoft.com/en-us/library/ie/hh180764(v=vs.85).aspx
If you need to override IE's Compatibility View Settings for intranet sites you can do so in the web.config (IIS7) or through the custom HTTP headers in the web site's properties (IIS6) and set X-UA-Compatible there. The meta tag doesn't override IE's intranet setting in Compatibility View Settings, but if you set it at the hosting server it will override the compatibility.
Example for web.config in IIS7:
Edit: I removed the
clear
code from just before theadd
; it was an unnecessary oversight from copying and pasting. Good catch, commenters!