How to disable Compatibility View in IE

前端 未结 8 1958
独厮守ぢ
独厮守ぢ 2020-12-04 07:24

I am wondering how do you stop people who are using IE 8 from going to Compatibility mode?



        
相关标签:
8条回答
  • 2020-12-04 07:47

    All you need is to force disable C.M. in IE - Just paste This code (in IE9 and under c.m. will be disabled):

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

    Source: http://twigstechtips.blogspot.com/2010/03/css-ie8-meta-tag-to-disable.html

    0 讨论(0)
  • 2020-12-04 07:47

    If you're using ASP.NET MVC, I found Response.AddHeader("X-UA-Compatible", "IE=edge,chrome=1") in a code block in _Layout to work quite well:

    @Code
        Response.AddHeader("X-UA-Compatible", "IE=edge,chrome=1")
    End Code
    <!DOCTYPE html>
    everything else
    
    0 讨论(0)
  • 2020-12-04 07:48
    <meta http-equiv="X-UA-Compatible" content="IE=8" /> 
    

    should force your page to render in IE8 standards. The user may add the site to compatibility list but this tag will take precedence.

    A quick way to check would be to load the page and type the following the address bar :

    javascript:alert(navigator.userAgent) 
    

    If you see IE7 in the string, it is loading in compatibility mode, otherwise not.

    0 讨论(0)
  • 2020-12-04 07:51

    The answer given by FelixFett worked for me. To reiterate:

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

    I have it as the first 'meta' tag in my code. I added 10 and 11 as those are versions that are published now for Internet Explorer.

    I would've just commented on his answer but I do not have a high enough reputation...

    0 讨论(0)
  • 2020-12-04 07:58

    In JSF I used:

    <h:head>
        <f:facet name="first">
            <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
        </f:facet>
    
        <!-- ... other meta tags ... -->
    
    </h:head>
    
    0 讨论(0)
  • 2020-12-04 07:59

    Adding a tag to your page will not control the UI in the Internet Control Panel (the dialog that appears when you selection Tools -> Options). If you're looking at your homepage which could be google.com, msn.com, about:blank or example.com, the Internet Control Panel has no way of knowing what the contents of your page may be, and it will not download it in the background.

    Have a look at this document on MSDN which discussed compatibility mode and how to turn it off for your site.

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