14

I've recently discovered the joys of adding the following into the header of sites:

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

Websites just work, CSS is beautiful and life is good. But I am slightly concerned about how good a practice this is?

What about an really old computer that has IE7 installed? Can that version of IE7 actually access the IE8 standards mode?

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Nadine
  • 777
  • 1
  • 11
  • 24

6 Answers6

24

The short answer to the last part of your question is no: IE7 can't be made to work in IE8 mode. So using the X-UA-Compatible header won't force older versions of IE to think they're a newer version. (if that worked, we could all just start using content="IE-10" and be done with worrying about backward compatibility forever)

What the X-UA-Compatible flag does is tell newer versions of IE to fall back into compatibility mode to emulate older versions. So therefore, your content="IE-8" flag will have no effect on IE7 or IE8, but will make IE9 fall back into IE8 mode.

This means that IE9 will effectively throw away its newer features, in the name of trying to be backward compatible.

If this is what you want from IE9, then by all means use the X-UA-Compatible header. If it isn't what you want, then don't use it.

(it's worth noting that the backward compatibility modes in IE are known to be not very good at being 100% compatible with real copies of the version they're trying to emulate, so don't think that you'll get a perfect copy of IE8 running in IE9 either -- it'll have it's own quirks that are different to either IE8 or IE9 in normal mode)

Spudley
  • 166,037
  • 39
  • 233
  • 307
  • Excellent answer and you have solved my missunderstanding of it. And now I feel somewhat dumb :) So it is for backward compatiblity :) Thank you! :) – Nadine May 04 '12 at 09:19
  • 1
    This is partially incorrect. While it will force a backwards compatibility mode for future versions it; it will also force current compatability (overidable by the client) for IE8. For example if a group policy says use compatibility view for all intranet sites then using this tag (either as an actual header or embedded in the html) will tell IE to ignore the GP as this site has been sufficiently tested on the stated version. The last part, however is true, there will be quirks regardless of if you are rendering at the latest version of IE or at a specified version without proper testing. – Colton Feb 27 '13 at 15:28
  • Thanks Sparksis, that was what I was looking for. I noticed my site randomly fell back to IE7 Mode (while browsing in IE8) making it render funny. using content="IE-8" fixed this issue. – Josh Mc Sep 11 '13 at 21:40
  • 4
    Internet Explorer should burn in hell! – Marco Demaio Feb 05 '14 at 15:20
  • 1
    @spudley it'll have it's own quirks that are different to either IE8 or IE9 in normal mode. Can you please share some more info on that. Any citation or links? – Mike May 15 '14 at 13:09
2

Another thing to be aware of is that the tag examples microsoft have provided don't always work. read defining document compatibility, especially the community additions at the bottom of the page.

As far as best practice goes, they are probably not the best long term solution but came in very handy when IE9 was released and sites went down.

Joe
  • 21
  • 2
1

Backward compatibility as rightly said by everyone should be applied only when it is strictly required as it does not works perfectly, and NO you can not get the features of new browser to old browser just by adding the compatibility tag.

0

I have IE8 installed in a Windows 7 test environment and it renders some parts of my code like IE7 did before (an there is no content="IE7" in my meta-tags)!
On another machine with Windows 7 + IE8, the code is rendered different, but the way I want.
There's an interesting article at http://www.greywyvern.com/?post=313 telling that the way IE8 renders depends of the Service Pack installed on the system (the article is about XP, but mine is Windows 7 and I have the same issue).

So now I put content="IE10" on my webpages and my website is correctly displayed in IE10, IE9 and IE8.

0

I'm using Discus, it is not compatible with older versions of IE. I got help they said to use content="IE-8" in my page code...

content="IE-8" also told my browser to change the sizes of tables and texts etc :p I changed to content="IE-7" it works perfect.

Real Hyder
  • 547
  • 5
  • 3
0

Adding <meta http-equiv=“X-UA-Compatible” content=“IE=8” /> mode in not probably good idea since it will stop your application to take advantages of newer versions of browser. But I think adding <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> is good since It forces the browser the render at whatever the most recent version's standards are.

Note: Adding Edge can potentially break your code since your application might not be tested for this new version. In most cases, this works absolutely fine, but you never know.

For details about other possible options refer

“X-UA-Compatible” content=“IE=9; IE=8; IE=7; IE=EDGE”

Community
  • 1
  • 1
Pranav Singh
  • 17,079
  • 30
  • 77
  • 104