Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
616 views
in Technique[技术] by (71.8m points)

internet explorer - Using <meta http-equiv="X-UA-Compatible" content="IE=8" /> mode in sites good practice?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...