Compatibility Mode doesn’t work in Internet Explorer 8.. Why?

Today I had a problem with IE8. Compatibility Mode for IE7 didn’t work when I was working with the Artisteer generated theme that I was improving by hands. The tag order does matter but I have never thought it would.

Note: The meta tag should be placed in the head section before any script or CSS. Read more at blogs.msdn.com.

So, in my HTML the meta tag was going after the script tag and therefore Compatibility Mode didn’t work! I had just moved the meta tag with Compatibility Mode to the beginning of the head and it was a workaround!

In this code Compatibility Mode doesn’t work:

<head>
<script type="text/javascript"> 
// some code 
</script>
<title>Title</title>
<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
</head>

In this code Compatibility Mode works:

<head>
<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
<script type="text/javascript"> 
// some code 
</script>
<title>Title</title>
</head>

Compatibility Mode Button

ie8compmode

If this buttons is visible the Compatibility Mode turned off and You can switch it. Otherwise, the Compatibility Mode turned on and You cannot switch between Standard Mode and Compatibility Mode. So, visibility of this button is a fast way to detect if the Compatibility Mode turned on or turned off.

Links

Artisteer – Web Design Generator

http://blogs.msdn.com/askie/archive/2009/03/23/understanding-compatibility-modes-in-internet-explorer-8.aspx

2 Responses to “Compatibility Mode doesn’t work in Internet Explorer 8.. Why?”