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?
As NEOSWF points out above, the Paul Irish conditional comments stops the meta tag having any affect.
There are several fixes all here (http://nicolasgallagher.com/better-conditional-classnames-for-hack-free-css/)
These include:
Adding two HTML classes, using server headers and adding a conditional comment above the doctype.
On my latest project I decided to remove the Paul Irish conditional comments. I didn't like the idea of adding anything before the html without doing LOTS of testing first and it's nice to see what has been set just by looking at the HTML.
In the end I surrounded a div straight after the body and used conditional comments eg
I could have done this around the body but its more difficult with CMSs like Wordpress.
Obviously its another DIV inside the markup, but its only for older browsers.
I think it could be a per project based decision though.
I've also read something about the charset meta tag needing to come in the first 1024 bytes so this ensures that.
Sometimes the simplest, easiest to read ideas are the best and its definitely worth thinking about! Thanks to the 6th comment on the link above for pointing this out.
I also got the same issue of IE9 rendering in IE7 Document standards for local host. I tried many conditional comments tags but unsuccesful. In the end I just removed all conditional tags and just added meta tag immediatly after head like below and it worked like charm.
Hope it helps
I was able to get around this loading the headers before the HTML with php, and it worked very well.
ix.html is the content I wanted to load after sending the headers.
When your browser opens with Compatibility Modes, even you remove and turn off all compability modes configuration from your web browser and Local Group Policy Editor, you can try to disable from register key.
This also happen to me on using domain and sub-domain to connect server side. The machine is restricted to open in compability mode for all sub-domain.
DISABLE COMPABILITY MODE FOR INTRANET
HKEY_LOCAL_MACHINE - SOFTWARE - Policies - Microsoft - Internet Explorer - BrowserEmulation -> IntranetCompalityMode Value should be 0 (zero). And also remove existing domain name from PolicyList.
Otherwise, you can add a new value (DWORD) that contain 0 (zero) value data.
Note that if you are serving it from PHP, you can use the following code to fix it as well.
If you are using LAMP stack, then add this into your .htaccess file in your web root folder. No need to add it to every PHP file.