我在我的超文本标记语言页面中有这样的标题,我在IE8中打开这个网站。当我在"Web Developer“中查看它时,"if IE7”是活动的。WebBrowser在"IE8压缩VIew“上设置BrowserMode,在"IE7标准”上设置“文档模式”。我有网站上的javascript,这与这些设置不好工作。为什么会发生这种情况?为什么IE变量等于7?为什么浏览器处于这些模式?
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]> <html lang="de" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="de" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="de" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="de" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html lang="de" class="no-js"> <!--<![endif]-->发布于 2011-10-13 21:01:33
其他人建议使用X-UA-Compatible IE=8,但请注意,这将强制IE在IE8模式下运行,即使用户拥有IE9 (或更高版本)。这通常不是你想要的。
最好指定IE应该使用可用的最新渲染引擎。为此,您使用相同的meta标记,但是使用IE=edge而不是IE=8作为值。
<meta http-equiv="X-UA-Compatible" content="IE=edge">请注意,IE有一个配置面板,允许您指定何时使用兼容模式。由于某些原因,默认情况下会对“本地intranet中的站点”使用兼容模式。
这是IE在开发站点时意外进入兼容模式的最常见原因,因为您的localhost服务器将被视为“在本地intranet中”。
您可以通过转到“工具”菜单,并选择“兼容性视图设置”选项来轻松地更改此设置。
发布于 2011-10-13 20:45:44
MSDN博客上的这篇文章解释了如何启用兼容模式。有一个很好的流程图:http://blogs.msdn.com/b/ie/archive/2010/03/02/how-ie8-determines-document-mode.aspx
要修复它,您还可以使用.htaccess文件或任何适合您的web服务器的文件来发送以下HTTP头:
X-UA-Compatible: IE=8这里有一个关于X-UA兼容的参考:http://msdn.microsoft.com/en-us/library/cc288325%28VS.85%29.aspx
发布于 2011-10-13 20:44:58
您需要告诉IE该页面确实可以使用它
尝试添加:
<!--Display in Native ie9 standards mode-->
<meta http-equiv="X-UA-Compatible" content="IE=9" >
<!--Display in Native ie8 standards mode-->
<meta http-equiv="X-UA-Compatible" content="IE=8" >
<!--Display in Native ie7 standards mode-->
<meta http-equiv="X-UA-Compatible" content="IE=7" >https://stackoverflow.com/questions/7754267
复制相似问题