为什么IE8处于IE7模式。变量“IE” == 7 [英] Why IE8 is in IE7 mode. Variable "IE" == 7

查看:128
本文介绍了为什么IE8处于IE7模式。变量“IE” == 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的HTML页面中的标题如下所示,我在IE8中打开此站点。
当我在Web Developer中查看它时,if IE 7处于活动状态。
WebBrowser在IE8 Compact VIew上设置BrowserMode,在IE7标准上设置文档模式。
我在网站上有javascript,这对这些设置效果不佳。
为什么会这样?为什么IE变量等于7?为什么浏览器处于这些模式?

I have the header in my HTML page like this below and I open this site in IE8. When I look at it in "Web Developer" the "if IE 7" is active. WebBrowser set BrowserMode on "IE8 Compact VIew" and "Document Mode" on "IE7 standards". I have javascript on the site, which doesn't work good with these settings. Why does it happen? Why IE variable is equal 7? Why Browser is in these mode?

<!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]-->


推荐答案

其他人建议使用 X -UA-Compatible IE = 8 ,但请注意,即使用户有IE9(或更高版本),这也会强制IE在IE8模式下运行。这通常不是你想要的。

Others have recommended using X-UA-Compatible IE=8, but note that this will force IE to run in IE8 mode, even if the user has IE9 (or later). This is generally not what you're going to want.

最好指定IE应该使用最新的渲染引擎。为此,您使用相同的 meta 标记,但使用 IE = edge 作为值,而不是 IE = 8

Better to specify that IE should use the latest rendering engine available to it. For that, you use the same meta tag, but use IE=edge as the value, instead of IE=8.

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


请注意IE有一个配置面板,允许您指定何时使用兼容模式。出于某种原因,默认情况下使用兼容模式本地Intranet中的站点。

Note that IE has a configuration panel which allows you to specify when it will use compatibility mode. For some reason, the default for this is to use compatibility mode for "sites in the local intranet".

这是IE意外跳入兼容模式的最常见原因当您开发网站时,因为您的 localhost 服务器将被视为在本地Intranet中。

This is the most common reason for IE jumping into compatibility mode unexpectedly when you're developing a site, as your localhost server will be treated as being "in the local intranet".

您可以通过转到工具菜单并选择兼容性视图设置选项轻松更改此设置。

You can change this setting easily enough by going to the "Tools" menu, and picking the "Compatibility View Settings" option.

这篇关于为什么IE8处于IE7模式。变量“IE” == 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆