How to overrde compatibility mode for intranet site when "Display intranet sites in Compatibility View" is checked?
How do you override the compatibility mode for an intranet site if the "Display intranet sites in Compatibility View" is checked? I am referring to the Browser Mode, not the Document Mode. Press F12 or select the Tools | Developer Tools menu to see what I mean. I keep reading that the meta tag will do this, but it doesn't for me. If the "Display intranet sites in Compatibility View" checkbox is checked, I can't get the Browser Mode to be IE8 no matter what value I set the meta X-UA-Compatible tag to.
Pro LINQ: Language Integrated Query in C# 2008 - http://www.linqdev.com - http://www.netsplore.com
Ditto this problem. Any solutions out there?
Meta tags do not seem to override the Intranet zone checkbox. If the site is added to "trusted sites," it works, but that would mean changing the setting for all internal users - not feasible.
The other option is to make sure IE8-compatibility mode and IE7 are rendering properly, and just let the users see what they see.
Any better ideas?
- Proposed as answer by tootsee1 Wednesday, November 18, 2009 8:20 PM
You can also set it as a http header, rather than setting it in the HTML of every page.
Just in case you hadn't found a solution yet: I ran across this same problem. The only way I found to override the "Display intranet sites in Compatibility View" setting was by setting the X-UA-Compatible host header for the particular site in IIS to "IE=8". This overrides the browser setting--but the meta tag does not for some reason.
- Proposed as answer by JoelMueller Tuesday, April 13, 2010 9:25 PM
Depending if if you are using Web Forms or MVC:
Web Forms - Make a Base Page class that inherits from Page and have your code behinds inherit from there on the few pages that have the exception. Add Response.AddHeader
Response.AddHeader("X-UA-Compatible" , "IE=8" );
Binding to Page_PreInit or something. Then any page inheriting from that "Page" will have that in the header automatically.
MVC - If you think its going to happen a lot you could add a controller attribute that adds the correct header on all controller actions with the attribute. If its only a few one off cases you might as well write a static function that you call during the controller action(s) that runs the above code.
Just a small correction here, if you get error like "Response.Headers.Add causes Requires IIS integrated pipeline mode exception" adding above code then use below code:
protected void Page_Init(object sender, EventArgs e)
To summarise, if your requirement is to turn off IE Compatibility mode from .net code behind, use above code in page_init of the page.
Works for me. For the record, the following tag is what he is referring to:
<meta http-equiv="X-UA-Compatible" content="IE=8" />
Since most web sites should be using some sort of shared layout (MVC) or master page (WebForms) the declarative syntax is better in my opinion. Although you may wish to choose a higher browser standards version.
Alternatively, there is a third way of configuring this globally, in the web config, documented here:
Regarding which version to Support, this article has a pretty good suggestion including other non-Microsoft browser versions:
<meta http-equiv="X-UA-Compatible" content="IE=8;FF=3;OtherUA=4" />
- Edited by Code Chief Thursday, February 14, 2013 1:15 PM