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

后端 未结 8 1522
伪装坚强ぢ
伪装坚强ぢ 2020-12-02 07:36

I have a website depending on vector drawing, for Internet Explorer I\'m using VML and for other browsers I\'m using SVG. IE8 however, doesn\'t have support for neither with

相关标签:
8条回答
  • 2020-12-02 08:04

    Wow Microsoft have really created a nightmare here. We're going to be talking about this well into the future!

    Anyway this works for me.

    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9" />
    
    0 讨论(0)
  • 2020-12-02 08:09

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

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

    For IE9 this gives me IE 9 compatibility mode with IE 9 standards. For IE8 this gives me Browser Mode IE8 Document Mode IE7 Standards

    0 讨论(0)
  • 2020-12-02 08:11

    This one works for IE9 to me.

    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
    
    0 讨论(0)
  • 2020-12-02 08:12

    I have so far used all these, 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 seems to be working. Microsoft, What is so difficult in supporting stuff you say should work in your documentation? we have to spend hours doing browser wars. You are wasting everyone's time.

    0 讨论(0)
  • 2020-12-02 08:13

    I think what you need is:

    <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 it states this as "... an example that combines values so that IE8 renders a webpage in IE7 Standards mode while IE9 renders the webpage in IE9’s Standards mode:"

    However I for one can't get this to work.

    0 讨论(0)
  • 2020-12-02 08:16

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

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

    That is with a comma not a semi colon!

    I haven't looked at the spec, but the format is similar to content="IE=7,chrome=1" that works for Chrome Frame. I also found that content="IE=7,9" works but I suspect that is not a correct format.

    Edit:

    Beware of a serious problem if your page is in a iframe. If you use the above in a framed page where the parent is in any mode less than IE9 strict, then IE9 will fall back to IE8 mode (ignoring the IE=7 request!). Any known workarounds welcome :) Might not be relevant to IE11.

    The above seems to be a side effect of the by design feature, that iframes (and I presume frames) are either all in IE9 mode, or all are less than IE9 mode. One can never mix IE9 frames with < IE9 frames, see MS issues #599022 and #635648.

    Edit 2:

    Beware that IE11 only supports "IE=edge" (not IE=11), and that using IE=edge has significant effects upon IE functionality (including the user agent).

    Edit 3:

    • Fantastic flow chart explaining how IE works out what mode to use for IE9
    • IE=edge is supported by IE8 through to IE11.
    • The Meta tag takes precedence over the HTTP header (which can be used instead of the meta tag)
    • Some more X-UA-Compatible info for IE10.

    Edit 4:

    X-UA-Compatible was removed from the Microsoft Edge browser. Only Internet Explorer has the compatibility modes. Beware that if you are using the WebView within an App on Windows Phone 10, then you are still using IE11 (not Edge).

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

    Edit 5:

    IE11 still needs X-UA-Compatible set to IE=EDGE for some corner cases e.g. a customer using IE11 from ActiveX (as WebView within a wrapper application) can drop IE11 back to IE7 mode if you don't set this.

    0 讨论(0)
提交回复
热议问题