IE8 automatically uses the “IE8 Compat View” browser mode and “IE7 Standards” document mode

こ雲淡風輕ζ 提交于 2019-12-24 01:06:53

问题


I built a website based on the HTML5 Boilerplate. I haven't changed anything in the boilerplate, other than adding my custom code to the Body part in the HTML. I'm targeting IE8 as the minimum IE version to support.

The problem is that when I open my page on IE8 it automatically uses the "IE8 Compat View" browser mode and the "IE7 Standards" document mode, instead of using the IE8 Standards for both browser and document modes.

Anyone has an idea why this might be happening and how to force it to use the right modes without requiring the user to change options in IE8?


回答1:


You might be testing the site on a local network. In this circumstances, IE8 will by default use the modes described in the question. IE8 has a different default behaviour for sites coming from a local network or intranet.

If the page you're testing is hosted outside the local network, then IE8 will use the correct standard modes.

If you need to test the website locally, just use IE8's developer tools to switch to the IE8 standard browser mode.




回答2:


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

Use the above meta tag to force IE to use the latest rendering engine it has available.




回答3:


The behavior chocobanana describes is also described here, see the entry "IE9 Compatibility View and Intranet Sites".

If you do not want to manually switch the browser/document modes in the developer tool all the time nor want to include a X-UA-Compatible-Tag you can undo the default setting that always renders intranet sites in compat mode by unchecking the respective checkbox in Tools > Compatibility View Settings.

Took me nearly a day to figure out why my local version in one IE8 tab looks fine while the intranet server version of the same page in another tab is all screwed up with regard to layout ... *sigh*

In any case, this only applies to your machine, so in order to force your clients to not fall into compat mode you will have to set the respective meta tag.




回答4:


Please check the following things:

1) Using "View source", Make sure that you are using

<!DOCTYPE html>

at the top of your pages.

2) If the line appears at the top, make sure that there are NO spaces or newlines before this line. It has happened to me that some PHP has an extra new line after the ?> that is printed to screen and causes the doctype not to appear as the very first thing on the document.



来源:https://stackoverflow.com/questions/13858491/ie8-automatically-uses-the-ie8-compat-view-browser-mode-and-ie7-standards-do

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