X-UA-Compatible Meta Tag Description and Uses

The X-UA-Compatible meta tag helps render Web pages in older IE browsers.

Illustration of 'e' symbol and arrow sign
Ivary/Getty Images

For many years, outdated versions of Microsoft's Internet Explorer browser caused headaches for website designers and developers. The need to create CSS files to specifically address those older IE versions is something that many long time web developers can remember. Thankfully, the newer versions of IE, as well as Microsoft's newest browser - Edge, are much more compliant with web standards, and since those newer Microsoft browsers are "ever green" in the way that they auto update to the latest version, it is unlikely that we will struggle with antiquated versions of this platform the way that we did in the past.

 

For most web designers, Microsoft's browser advances mean that we no longer have to deal with the challenges that the old IE version presented us in the past. Some of us, however, are not so fortunate. If a site you are managing still includes a sizable number of visitors from an older IE version, or if you are working on an internal resources, like an Intranet, for a company that is using one of these older IE versions for some reason, then you will need to continue testing for these browsers, even though that are outdated. One way you may do this is by using X-UA-Compatible mode.

X-UA-Compatible is a document mode meta tag that allows web authors to choose what version of Internet Explorer the page should be rendered as. It is used by Internet Explorer 8 to specify whether a page should be rendered as IE 7 (compatibility view) or IE 8 (standards view).

Note that with Internet Explorer 11, document modes have been deprecated—they are no longer used. IE11 has updated support for web standards that caused issues with older websites.

To do this, you specify the user agent and version to use in the contents of the tag:

"IE=EmulateIE7"

The options you have for the content are:

  • "IE=5"
  • "IE=EmulateIE7"
  • "IE=7"
  • "IE=EmulateIE8"
  • "IE=8"
  • "IE=EmulateIE9"
  • "IE=9"
  • "IE=edge"

Emulating the version tells the browser to use the DOCTYPE to determine how to render content.

pages without a DOCTYPE will be rendered in quirks mode.

If you tell it to use the browser version without emulating (i.e., "IE=7") the browser will render the page in standards mode whether or not there is a DOCTYPE declaration.

"IE=edge" tells Internet Explorer to use the highest mode available to that version of IE. Internet Explorer 8 can support up to IE8 modes, IE9 can support IE9 modes and so on.

X-UA-Compatible Meta Tag Type:

The X-UA-Compatible meta tag is a http-equiv meta tag.

X-UA-Compatible Meta Tag Format:

Emulate IE 7

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

Display as IE 8 with or without a DOCTYPE

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

Quirks Mode (IE 5)

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

X-UA-Compatible Meta Tag Recommended Uses:

Use the X-UA-Compatible meta tag on web pages where you suspect that Internet Explorer 8 will attempt to render the page in an incorrect view. Such as when you have an XHTML document with an XML declaration. The XML declaration at the top of the document will throw the page into compatibility view but the DOCTYPE declaration should force it to be rendered in standards view.

Reality Check

It is admittedly unlikely that you are working on any websites that need to render as IE 5, but you never know!

There are still companies who force employees to use very, very old versions of browsers in order to continue using proprietary legacy software that was developed ages ago for these specific browsers. For those of us in the web industry, the idea of using a browser like this seems crazy, but imagine a manufacturing company that uses a decades old program to manage inventory on their shop floor. Yes, there are certainly modern platforms to do this, but have they invested in one of those platforms?  If their current system is not broken, why would they change it?  In many cases, they won't, and you will find this company forcing employees to use that software and the antique browser sure to run it. Unlikely? Perhaps, but it is certainly possible.  if you run into an issue like this, being able to run site in these older document modes may ended up being exactly what you need.

Original article by Jennifer Krynin. Edited by Jeremy Girard on 6/7/17