IE 8 has the dubious advantage of multiple rendering engines to choose from via the “Compatibility Mode” options. Personally, I like this feature, but what I’ve discovered is that a lot of users don’t know this feature exists which leads to the problem of them viewing everything in IE 7 mode by having the “Display all websites in Compatibilty View” setting turned on.
I’m not sure if this option is turned on by default on a fresh install of IE 8 or if users turn it on when they setup IE 8 for the first time (and I mean really, who wouldn’t choose compatibility?). The bottom line though, is if a user has upgraded to IE 8 you want to give them the best experience you can by using the most modern rendering engine.
Microsoft gave us a way to specify the rendering engine by using the X-UA-Compatible http header or meta tag. You can use this to force IE 8 to use the IE 8 rendering mode even if the user has compatibility mode turned on. So, if you’re building a new site, why give your IE 8 users the option to render your beautiful css and html in IE 7 mode?
Here’s how to use the meta-tag option, this tag should be at the top of the <head> section of your page:
<meta http-equiv=”X-UA-Compatible” content=”IE=8″ />
Or you can set the http header in your Apache config:
Header onsuccess set “X-UA-Compatible” “IE=8″
If you want to limit the http header to a subset of your domain you can use environment variables in Apache:
SetEnvIf Request_URI “/myapp/” is_my_app=1
Header onsuccess set “X-UA-Compatible” “IE=8″ env=is_my_app