dpo*_*ski 3 compatibility internet-explorer internet-explorer-8 ie-compatibility-mode
我在我的HTML页面中有如下所示的标题,我在IE8中打开此站点.当我在"Web Developer"中查看时,"if IE 7"处于活动状态.WebBrowser在"IE8 Compact 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]-->
Run Code Online (Sandbox Code Playgroud)
其他人建议使用X-UA-Compatible IE=8,但请注意,这将迫使IE在IE8模式下运行,即使用户有IE9(或更高版本).这通常不是你想要的.
最好指定IE应该使用最新的渲染引擎.为此,您使用相同的meta标记,但使用IE=edge值而不是IE=8.
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Run Code Online (Sandbox Code Playgroud)
请注意,IE有一个配置面板,允许您指定何时使用兼容模式.出于某种原因,默认设置是对"本地Intranet中的站点"使用兼容模式.
这是IE在开发站点时意外跳入兼容模式的最常见原因,因为您的localhost服务器将被视为"在本地Intranet中".
您可以通过转到"工具"菜单并选择"兼容性视图设置"选项轻松更改此设置.
| 归档时间: |
|
| 查看次数: |
3249 次 |
| 最近记录: |