Emulate IE7 for IE8 but not for IE9 using "X-UA-Compatible"

I have a website depending on vector drawing, for Internet Explorer I use VML, and for other browsers I use SVG. However, IE8 does not support either of these without returning to IE7 mode with VML.

Therefore, I include <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> .

The problem (well, actually, a good thing) is that IE9 now supports SVG, so I don't want it to return to IE7 mode, which has much worse performance and compatibility. How can I tell only IE8 to return to IE7 mode, but let IE9 stay in IE9 mode.

Now I am doing a server-side check on the agent whether I need to include the EmulateIE7 line in my head or not, but I want to avoid this as much as possible.

+41
html internet-explorer svg vml
Aug 05 '10 at 10:01
source share
8 answers

I just had a game and I found the following works for me:

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

That is, with a comma, not with a colon!

I did not consider the specification, but the format is similar to content = "IE = 7, chrome = 1", which works for Chrome Frame. I also found that content = "IE = 7.9" works, but I suspect that this is not the correct format.

Edit:

Beware of a serious problem if your page is in an iframe. If you use the above on a page with a frame where the parent is in any mode other than IE9, then IE9 will return to IE8 mode (ignoring the request IE = 7!). Any known workarounds are welcome :) Perhaps this is not the case with IE11.

The above seems to be a side effect of the design function that iframes (and I assume the frames) are either all in IE9 mode or all smaller than IE9 mode. You cannot mix IE9 frames with <IE9 frames, see Issues MS # 599022 and # 635648 .

Edit 2:

Beware that IE11 only supports "IE = edge" (not IE = 11) and that using IE = edge has a significant impact on the functionality of IE (including the user agent).

Edit 3:

Change 4:

X-UA-Compatible been removed from the Microsoft Edge browser. Only Internet Explorer has compatibility modes. Remember that if you use WebView in an application on Windows Phone 10, you still use IE11 (not Edge).

Also, for various reasons, you cannot trust the user agent to tell you the correct level of compatibility, use document.documentMode from JavaScript instead.

+41
Dec 02 '10 at 2:26
source share

The dual mode mentioned by someone else should work (but not as Microsoft has shown), and this is the closest I've seen in the MS documentation, which should work as described. There below is an update showing the correct form that the meta attribute value should take.

So if you use this:

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

Unfortunately, what you get is IE8 rendering like IE8 due to the fuzzy vector version that the x-ua-compatible engine makes. See This document: Defining Document Compatibility: Representation of Content Attribute Values in MSDN. In this section, you will see that in the first half of the year they define any version vector that is larger than the current version of the browser and will be interpreted as the largest rendering mechanism available. Therefore, emulateIE9 translates to emulateIE8. Stupid.

Then, almost in one breath, they talk about using several version vectors, as in the code snippet above, to exclude a specific engine. But due to the logic of the fuzzy version, this will never work. Ah, Microsoft. Fail again.

The reason why using CCs around meta won't work is because the browser had to choose a rendering engine by the time it gets to CC. The x-ua meta tag must be present before anything else in the header, except for other meta or header in accordance with MS's own documentation.

If anyone can figure this out, I'm all ears because I desperately want to exclude IE8 from support, including IE9.

IMPORTANT UPDATE :

Robocat indicates using a comma rather than a semi-colon, as Micrsoft shows the right way to do this. I tested it and it worked for me. I updated the test page.

So the form is correct - this is (as suggested by robocat):

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

The form is wrong - this is (as suggested by Microsoft):

 <meta http-equiv="X-UA-Compatible" content="IE=7; IE=9"> 
+27
Oct 20 2018-10-1020:
source share

I still used all this, nothing works on IE9:

 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" > <meta http-equiv="X-UA-Compatible" content="IE=8" > <httpProtocol> <customHeaders> <clear /> <add name="X-UA-Compatible" value="IE=EmulateIE8" /> </customHeaders> </httpProtocol> 

This is so frustrating, none of these meta tags seem to work. Microsoft What is so difficult in supporting what you say should work in your documentation? we must spend hours on military wars. You are wasting time on everything.

+3
May 25 '11 at 16:26
source share

If you want IE 8 to use IE7 and IE9 standards to use IE9 standards, this worked for me:

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

For IE9 it gives me compatibility mode with IE 9 with IE 9 standards. For IE8 it gives me IE8 browser mode IE7 document mode Standards

+3
Oct 18 '11 at 11:07
source share

This works for IE9 for me.

 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/> 
0
Jul 29 '15 at 21:53
source share

I think you need:

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

according to http://blogs.msdn.com/b/ie/archive/2010/06/16/ie-s-compatibility-features-for-site-developers.aspx , as he points it as "... example, which combines values ​​so that IE8 displays a webpage in IE7 standard, while IE9 displays a webpage in IE9s standard mode: "

However, I cannot get this to work.

-one
Oct 05 2018-10-10
source share

Wow, Microsoft really created a nightmare here. We will talk about this in the future!

Anyway, this works for me.

 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9" /> 
-one
Oct 29 '10 at 4:27
source share
 <!--[if IE 8]> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <![endif]--> 

He called conditional comments.
http://en.wikipedia.org/wiki/Conditional_comment

-3
Aug 05 '10 at 10:08
source share



All Articles