Wednesday, May 4, 2011

Overriding Internet Explorer Compatibility Mode for intranet sites

Many corporate environments (including my own) have the "Display intranet sites in Compatibility View" setting enabled. This means that, even if you use the new <doctype html> tag, your intranet site will render in Compatibility Mode. This means that Internet Explorer 8 will render your site in Internet Explorer 7 mode.

I found a fantastic summary of the decision tree that Internet Explorer uses when deciding how to render a page. Using this information, I tried adding the following tag to each page:

<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>

This tag will override the Compatibility Mode settings and the browser will render in the most standards compliant way.

The downside of this tag is that it is not standard HTML, and will fail HTML validation.

0 comments:

Post a Comment