Search code examples
internet-explorerinternet-explorer-8internet-explorer-9x-ua-compatibleie-compatibility-mode

How to disable Compatibility View in IE


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

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

I found this tag and I think this forces people to stay in IE-8 mode but I am not too sure and can't check as I have IE 9.

If people are in IE 9 mode I force them to not go into IE 8 or IE 7 Compatibility mode?

I tried to put the above line in my code and went to IE 9 -> Tools -> Compatibility View(Grayed Out)

but "Compatibility View Settings" was not grayed out and it seems you could add the site through there.

So should that not disable?


Solution

  • <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.