Remove “compatibility view” button in Internet Explorer

Old Internet Explorer version are often a big problem for web developers. Fortunately everyday the people using IE 7, IE6 or even IE5.5 became lesser and lesser. So usually we don’t have to spend to much time to fix everything in our CSS to make every page look perfect in all this old browsers because people using them are not so relevant.

Passing from IE7 to IE8 Microsoft  had the “brilliant” idea to help developers with this huge step forward, in particular enterprise sites was in past often strictly related to a browser version and the change could be a big problem for them. The solution was the “compatibility view” button, the button with a broken page icon, which switches your modern browser to an old IE7 mode. Holy crap! :-O

In real life the button is almost useless because Internet sites are already prepared to offer the content to the browser in a best way using different solutions (conditional comments, server side browser detection, javascript, CSS hacks, ignoring…) BUT sometimes users could press the stupid button while trying to press the “Reload Page” button. It’s like a nuke because instantly your browser start to render pages like the old IE7 and everything will look broken or wrong.

The “Compatibility View” is domain scoped and remembers the setting even after the browser was closed. So what can we do?

We can say to Internet Explorer: hey don’t worry, everything is okay! It’s pretty easy, we have just to use the X-UA-Compatible header and set this value: IE=edge. In a HTML page you can use a meta tag:

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

Or you can choose to add it to your web server configuration. What does it mean? It says to Explorer to use his last standard mode. So IE8 will render the pageas IE8, IE9 like IE9 and so one and the “Compatibility Button” will disappear. Gotcha!

Leave a Reply

Your email address will not be published. Required fields are marked *