Force IE 7 Compatiblity Mode in IE8

大城市里の小女人 提交于 2020-01-05 12:14:55

问题


I have a c# asp.net website and needs to run in compatibility mode. The website runs (forced) in a popup. I have searched on google and stackoverflow about how to force compatibility mode and found scripts like:

<meta http-equiv="X-UA-Compatible" value="IE=7"> 
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="X-UA-Compatible" value="IE=8"> 

I have tried some of above but when I start the website in the browser and then pres on the F12 key, I see the following mode:

Browser Mode: IE8 Document Mode: Quirks

So the browser mode not changed to the compatibility mode.

Does someone know what my problem is?


回答1:


Compatibility Mode is one of the Browser Mode settings; you don't have any ability to change the users browser to compatibility mode. You can only control the document mode of your page - this is what you're seeing in the examples you provided.

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

This will force the document into IE7 Standards Mode. If you were to use the EmulateIE7 option, that would look to your doctype to determine if it ought to be Standards, or Quirks. This is the only option offered to you regarding how your page is viewed in the users browser.

Be sure to place that within the <head> region of the page you wish to affect. Additionally, when you're checking the Document Mode, look for which options has "(Page Default)" next to it and not which options is selected.

IE will respect your manual override over the x-ua meta tag. It may be the case that you accidentally moved set the document mode to Quirks while testing, even though the default mode for the page has been adjusted to IE7 by the meta tag.

Further Reading: Defining Document Compatibility



来源:https://stackoverflow.com/questions/10884107/force-ie-7-compatiblity-mode-in-ie8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!