IE X-UA-Compatible Multiple Versions & Conditional Comments

Internet Explorer v9 will include includes a great many performance & compatibility enhancements over its predecessors. For IE8, it has been useful to limit its rendering engine to display as IE7′s: for this, the X-UA-Compatible header is used,
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
as documented at MSDN.

To target different versions of IE with different engines, for example when needing IE8 to use IE7-mode but leaving IE9 to use the latest engine, MSDN states to use the following syntax, eg:

<!-- MSDN-recommended syntax (warning: see note below) --> <meta http-equiv="X-UA-Compatible" content="IE=7;IE=9" />

However, as stated in this post at stackoverflow, this does not work: instead, use a comma to separate the values (“,”), rather than a semi-colon (“;”):

<!-- Correct (working) syntax --> <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />

In theory, an alternative would involve wrapping the X-UA-Compatible <meta> tag with some of IE’s proprietary conditional comments (condcoms). Unfortunately, this would present a “chicken-and-egg” problem, as the effective browser version (ie. v8 for IE8, v7 if EmulateIE7-mode) must be determined before any condcoms are evaluated: this means the X-UA-Compatible tag cannot then change the browser version (for example, to “EmulateIE7″).

Modes for “IE=” component of X-UA-Compatible:

IE=7
IE7 – forced mode, rendering will always be as for 7
IE=EmulateIE7
IE7 – emulated mode, rendering will be determined as it would in IE7 itself, using <!DOCTYPE …>, choosing between IE5-compatible “quirks” mode or IE7′s “standards-compliant” mode
Cheers, Dan Phillimore

About the author

  • Dan has spent the past 10 years developing specialist software, using everything from x86 assembly to C++ and VB. For the past few years he has focused on JavaScript development of high-performance virtual machines for the modern web and developing bespoke modern websites using the LAMP stack.
  • When he is not working on the next web-based OS, he spends his time out with friends, his girlfriend Jen or planning to buy an American muscle car.
You can leave a response, or trackback from your own site.

Leave a Reply

Powered by WordPress | Design by OVMS, based on AnimeStar (Best MMORPGs | Thanks to MMORPG List, VPS Hosting and Website Hosting)