Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the point of X-UA-Compatible?

I don't understand at all what <meta http-equiv="X-UA-Compatible" content="..." /> is for...

Can someone explain...

  • What it does for different values of content?
  • What omitting it does for different browsers?
  • What the motivation for it is?
  • Why it exists?
like image 854
Farley McJizzle Avatar asked Sep 04 '11 18:09

Farley McJizzle


2 Answers

This meta tag (or http header) only has meaning for IE8 and up. It is a way to force IE to render the page as an older version would have. Omitting it has no effect, it only as effect if used.

Possible values are "IE=" followed by any of the following:

  • Edge - Render as whatever the latest version of IE is
  • IE9 - Render as IE9 in standards mode
  • Emulate IE9 - Render as IE9 but use the <!DOCTYPE> to determine the mode
  • IE8 - Render as IE8 in standards mode
  • Emulate IE8 - Render as IE8 but use the <!DOCTYPE> to determine the mode
  • IE7 - Render as IE7 in standards mode
  • Emulate IE7 - Render as IE7 but use the <!DOCTYPE> to determine the mode
  • IE5 - Render as IE7 in quirks mode

Additionally, you can add a comma followed by Chrome=1 to tell IE to render the page using Google Chrome Frame if it is installed. So you might have a tag that looks like this:

<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">

Or, instead of that, you can also specify to use GCF for for a specific version of IE and below like this:

<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=IE8">

Which means to use GCF if it is installed and IE is at version 8 or below otherwise, render as the latest installed version of IE.

So, it's obvious that it is useful to be able to make older versions of IE use GCF but that was probably not Microsoft's intention when they implemented this. It can be used for compatibility with old sites that only work in older versions of IE and can't be easily fixed but that's kind of silly. Personally, I find it useful for testing. Since it's generally not so simple to test multiple versions of IE from a single development machine, this provides a decent solution.

like image 83
Okonomiyaki3000 Avatar answered Sep 25 '22 12:09

Okonomiyaki3000


It's a horrible hack to cater for different bugs or incomplete implementations in various versions of the Internet Explorer browser. For example, this:

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

will instruct IE9 to pretend it's really IE7 to avoid any problems that might occur if your site works in IE7 but not IE9.

like image 31
Bobby Jack Avatar answered Sep 23 '22 12:09

Bobby Jack