Detect IE8 Compatibility Mode

I have recently had a client who complained to me that the site was broken in IE8 even though I had already checked it out. It turns out the issue was M$'s great "Compatibility Mode"

I know my way around CSS well enough but it felt wrong making any changes to keep this IE only mode happy when all other browsers were not complaining. Bing! I had an idea and went to Google and found this document on Defining Document Compatibility.

Turns out I can force the users browser to IE8 mode with the following

view plain print about
1<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >

Hopefully this will help some other developer with their designing woes.

Posted: 28-Jul-2010

View: 3680

Permalink: here

Comments

Just implemented this myself last week. That meta tag has to be declared before any script tags in the HTML head.

When using CFFORM on a template, Coldfusion 8 (not sure about other versions) injects the cfform.js file at the beginning of the HTML head. This prevents the meta tag from functioning.

So, I used the HTTP Header method .... like so:
<cfheader name = "X-UA-Compatible" value = "IE=Edge">

#1 Aaron Terry
28/Jul/10 2:00 AM

Thanks guys - both of you helped me with the exact same issue you described. A lot of XHTML layouts don't display well in compatibility mode :p

#2 SafariTECH
24/Sep/10 12:05 AM

Thanks for posting this. It really helped me out. One suggestion is that you need to close the meta tag in order for this to be XHTML compliant, and it is good practice for html too.

#3 Matt
31/Mar/11 8:32 PM