Force IE Compatibility Mode Off

I found some strange rendering issues happening with a site on IE that we couldn't replicate in our test environment. We finally found out those who were experiencing the issue were on the Active Directory for the same domain. Turns out, one of the group policies is to automatically set compatibility mode to on for everything in their domain. Turns out IE will respond to specific headers in order to forcefully define the compatibility mode to a specific version. You can define it as an HTML <meta> tag or in the raw http header.

To add the http header in Drupal, add the following line to your theme's preprocess function

// Drupal 7 in hook_preprocess_html()
drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');

// Drupal 6 in hook_preprocess_page()
drupal_set_header('X-UA-Compatible: IE=edge,chrome=1');

The IE=edge value means to use the latest rending mode. This will make sure when future versions of IE come out, your site will still request to use the latest rendering mode. You can also define specific versions of compatibility mode. The chrome=1 portion tells IE to use the, now deprecated, ChromeFrame plugin, if installed, to render the page with WebKit instead of the IE rendering engine.

I found when trying to use the <meta> tag option, you need to make sure it is the first tag within the head, before any CSS or JavaScript. It can be difficult to do, and also requires a bit more code to implement properly in a Drupal theme.