ChatGPT解决这个技术问题 Extra ChatGPT

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

<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE" />

Actually what is the meaning of this statement ? Some of the examples use , to separate versions of IE, while some use ;; which is correct? The order IE=9; IE=8; IE=7; IE=EDGE has some importance, I wish to know that.

Edit: I am using <!DOCTYPE html>

i think IE=9 not fit for X-UA-Compatible

m
mikemaccana

If you support IE, for versions of Internet Explorer 8 and above, this:

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

Forces the browser to render as that particular version's standards. It is not supported for IE7 and below.

If you separate with semi-colon, it sets compatibility levels for different versions. For example:

<meta http-equiv="X-UA-Compatible" content="IE=7; IE=9" />

Renders IE7 and IE8 as IE7, but IE9 as IE9. It allows for different levels of backwards compatibility. In real life, though, you should only chose one of the options:

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

This allows for much easier testing and maintenance. Although generally the more useful version of this is using Emulate:

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

For this:

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

It forces the browser the render at whatever the most recent version's standards are.

For more information, there is plenty to read about on MSDN,


the order IE=9; IE=8; IE=7; IE=EDGE has some importance, i wish to know that
I have a bit of a gap in my understanding of this. If my target for testing is IE8, but I don't want to break IE7, what would you set this meta tag to? And do any other browsers use this?
IE7 will not recognize this, it was implemented first in IE8. The entire reference to IE7 above is if, for example, you were using IE7 as the basis for testing, and wanted all more modern versions of IE to render as it would in IE7 standards. no other browsers use this tag.
IE10 renders old web apps well with IE=8 (YMMV), however IE11 emulation of IE8 breaks. This UA: content="IE=8; IE=11" gives browser mode IE10 Compat Document mode IE8 standards in IE10, and Document mode edge in IE11. One of the issues with IE10 and IE11 UA assignment is that Microsoft removed conditional comments.
Based on that meta tag, IE11 would not emulate IE8, it would assume IE11 (as that was given in the semicolon-separated list). That list would also explain the fallback to IE8 standards because IE10 was unaware of the existence of IE11, just as IE8 could not apply IE9 standards. Have you tried simply using content="IE=8"? Or, preferrably, content="IE=EmulateIE8"?
C
Community

In certain cases, it might be necessary to restrict the display of a webpage to a document mode supported by an earlier version of Internet Explorer. You can do this by serving the page with an x-ua-compatible header. For more info, see Specifying legacy document modes. - https://msdn.microsoft.com/library/cc288325

Thus this tag is used to future proof the webpage, such that the older / compatible engine is used to render it the same way as intended by the creator.

Make sure that you have checked it to work properly with the IE version you specify.