Disable ‘Compatibility Mode’ in Internet Explorer (IE) 8 / 9

compatibilty-modeOver the past few months you put tons of time and effort into your awesome new site. However, your roll it live and find out that someone accidentally has Compatibility Mode mode in IE turned on. Now your scripts don’t function exactly how you imagined and your layout is acting funky. There are some Meta tags that apparently take care of this if you add them to your page (<meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″ />) but personally I haven’t had great success with these. Below is the way I found best in .net to disable and turn off Compatibility Mode in IE:

On your page (preferably master page in web forms or mvc) add this line:

<% Response.AddHeader(“X-UA-Compatible”, “IE=edge,chrome=1”); %>

In my case I’m adding it below the <%@ Master Language=”C#” … line before the start of content (doctype).

Update: You can also easily add the header in IIS (no need to update your code) by going to ‘http response headers’ and choosing ‘add’:

iis_comp-view

 

 

 

Disable ‘Compatibility Mode’ in Internet Explorer (IE) 8 / 9

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s