I am doing work for a client who forces compatibility mode on all intranet sites. I was wondering if there is a tag I can put into my HTML that forces compatibility mode off.
相关问题
- Views base64 encoded blob in HTML with PHP
- How to fix IE ClearType + jQuery opacity problem i
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
Insert as the very first item under the tag.
This forces IE to render the page in the physical version of IE, and it ignores the Browser "Mode setting". This can be set in the developer tools, try changing it to a older version of IE to test, this should be ignored and the page should look exactly the same.
The meta tag solution wasn't working for us but setting it in the response header did:
Just a few more notes on this topic based on my recent experiences. The university I work for issues laptops with IE 8 set to compatibility mode for all Intranet Sites. I tried adding the meta tag to disable this mode for pages being served up by my site but IE consistently ignored this tag. As Lance mentioned in his post, adding a response header fixed this issue. This is how I set the header based on the HTML5 boilerplate method:
In order for this header to actually be sent, you have to make sure you have mod_headers turned on in Apache. If you want to make sure you have this mod turned on, put this in a page that can run php:
As suggested in this answer to a related question, "edge" mode can be set in the Web.Config file. This will make it apply to all HTML returned from the application without the need to insert it into individual pages:
This same step can also be accomplished by modifying the "HTTP Response Headers" using IIS Manager for the IIS server, entire website, or specific applications.
After many hours troubleshooting this stuff... Here are some quick highlights that helped us from the
X-UA-Compatible
docs: http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx#ctl00_contentContainer_ctl16Using
<meta http-equiv="X-UA-Compatible" content=" _______ " />
The Standard User Agent modes (the non-emulate ones) ignore
<!DOCTYPE>
directives in your page and render based on the standards supported by that version of IE (e.g.,IE=8
will better obey table border spacing and some pseudo selectors thanIE=7
).Whereas, the Emulate modes tell IE to follow any
<!DOCTYPE>
directives in your page, rendering standards mode based the version you choose and quirks mode based onIE=5
Possible values for the
content
attribute are:content="IE=5"
content="IE=7"
content="IE=EmulateIE7"
content="IE=8"
content="IE=EmulateIE8"
content="IE=9"
content="IE=EmulateIE9"
content="IE=edge"
There is the "edge" mode.
From the linked MSDN page:
However, "edge" mode is not encouraged in production use:
I honestly don't entirely understand why. But according to this, the best way to go at the moment is using
IE=8
.