Remove Internet Explorer’s “Compatibility View” button

Compatibility View?

With Internet Explorer 8, Microsoft introduced the concept of Compatibility View.

If a page does not display properly using the normal standard mode, IE8 can detect it, and automatically switch to compatibility mode.

There is also a button to switch modes manually: It’s a button that looks like a torn up piece of paper, and you will find it in the navigation bar.

Compatibility View button in IE

Did you know that there was a way to prevent this button from showing on your website?

The X-UA-Compatible header

Internet Explorer 8 added support for a new header called X-UA-Compatible.

This header tells Internet Explorer which engine version should be used to display a page.

If its value is set to IE=egde, thisĀ  forces Internet Explorer to always use the “standard” mode. When you do this, IE8, IE9 (and possibly future versions of IE) will not display the “Compatibility View” button.

Implementation

In a meta tag

Inside your document <head>, insert the following meta tag:

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

In PHP

header('X-UA-Compatible: IE=edge');

In .htaccess

<FilesMatch "\.(php|html)$">
   Header set X-UA-Compatible "IE=edge"
</FilesMatch>

More information about the X-UA-Compatible header and its possibilities is available at the Microsoft MSDN Library.

This entry was posted in PHP. Bookmark the permalink.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>