Internet Explorer 8 EmulateIE7模式无法正常工作

时间:2021-12-12 17:04:08

I've set up IIS6 to send the following headers

我已经设置IIS6来发送以下标头

Custom Header Name: X-UA-Compatible
Custom Header Value: IE=EmulateIE7

自定义标题名称:X-UA兼容自定义标题值:IE = EmulateIE7

that supposed to force IE 8 into IE 7 Compatibility mode. You can read more about it on MSDN .

应该强制IE 8进入IE 7兼容模式。您可以在MSDN上阅读更多相关信息。

I have noticed by looking in the Developer toolbar that if I have a DTD defined the document mode correctly gets set to IE 7, but the browser mode is IE 8. If the page doesn't have a DTD the document mode gets set to Quirks and Browser Mode once again IE 8.

我注意到在Developer工具栏中查看如果我定义了DTD,文档模式正确设置为IE 7,但浏览器模式是IE 8.如果页面没有DTD,则文档模式设置为Quirks和浏览器模式再次IE 8。

Am I doing something wrong. How do I force IE 8 to set IE 7 Browser mode.

难道我做错了什么。如何强制IE 8设置IE 7浏览器模式。

Thanks

7 个解决方案

#1


Browser Mode refers to the user-agent header sent by the browser. Since the UA has already been sent before the HTTP response comes back containing your EmulateIE7 directive, it's too late to change the browser mode; only the document mode is changed.

浏览器模式是指浏览器发送的用户代理标头。由于在包含EmulateIE7指令的HTTP响应返回之前已经发送了UA,因此更改浏览器模式为时已晚;仅更改了文档模式。

See http://msdn.microsoft.com/en-us/library/dd565628(VS.85).aspx#bdmodes

#2


I've used this meta tag to force the IE7 mode:

我用这个元标记强制IE7模式:

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

Important: you must put this before any other tags in <head>!

重要提示:您必须在中的任何其他标记之前放置它!

(actually you might be able to put a <title> before this, but not putting anything is easier to remember than the specific cases)

(实际上你可以在此之前放一个

,但是没有比特定情况更容易记住任何东西)</p>

#3


Check this link

检查此链接

http://ilia.ws/archives/196-IE8-X-UA-Compatible-Rant.html

Need to add a custom header as described in the link. Still looking for a non header solution when using the transitional DTD.

需要添加链接中所述的自定义标头。在使用过渡DTD时仍在寻找非标头解决方案。

#4


I think that's working as designed. I've been using that header value with no problems.

我认为这是按设计工作的。我一直在使用该标头值没有问题。

Are you having rendering issues on your pages? You could try using IE=IE7 instead.

您的网页上是否存在渲染问题?您可以尝试使用IE = IE7。

#5


found this solution... hope it works!

找到了这个解决方案...希望它有效!

Notice: You will have to put the "header" line before any html is sent to the browser (http://www.php.net/header)

注意:在将任何html发送到浏览器之前,您必须放置“标题”行(http://www.php.net/header)

It's PHP code, the line should be like this:

它是PHP代码,行应该是这样的:

header('X-UA-Compatible: IE=7');

#6


If you followed that guide too closely you will miss the fact that the web.config way of fixing this is only supported in IIS 7 +.

如果您过于仔细地遵循该指南,您将会错过这样一个事实,即只在IIS 7 +中支持修复此问题的web.config方法。

Via [MSDN] article link in OP

通过OP中的[MSDN]文章链接

Configuring Web Servers to Specify Default Compatibility Modes

配置Web服务器以指定默认兼容模式

Site administrators can configure their sites to default to a specific document compatibility mode by defining a custom header for the site. The specific process depends on your Web server. For example, the following web.config file enables Microsoft Internet Information Services (IIS) to define a custom header that automatically renders all pages in IE7 mode.

站点管理员可以通过为站点定义自定义标头,将其站点配置为默认为特定文档兼容模式。具体过程取决于您的Web服务器。例如,以下web.config文件使Microsoft Internet信息服务(IIS)能够定义自动呈现IE7模式下所有页面的自定义标头。

BUT see: IIS.NET article

但请参阅:IIS.NET文章

IIS 7.0  The <customHeaders> element of the <httpProtocol> element was introduced in IIS 7.0.

#7


    <!-- Use IE7 mode added on 13th October for IE8 BSCI-->
           <!--  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> -->
    <!-- Use IE7 mode added on 20th October for IE8 BSCI-->
            <meta http-equiv="X-UA-Compatible" content="IE=IE7" /> <!--- This appears to work on testing! -->    
            <!-- END -->   

Using 'Emulate' did not work but IE=IE7 did

使用'Emulate'不起作用,但IE = IE7

#1


Browser Mode refers to the user-agent header sent by the browser. Since the UA has already been sent before the HTTP response comes back containing your EmulateIE7 directive, it's too late to change the browser mode; only the document mode is changed.

浏览器模式是指浏览器发送的用户代理标头。由于在包含EmulateIE7指令的HTTP响应返回之前已经发送了UA,因此更改浏览器模式为时已晚;仅更改了文档模式。

See http://msdn.microsoft.com/en-us/library/dd565628(VS.85).aspx#bdmodes

#2


I've used this meta tag to force the IE7 mode:

我用这个元标记强制IE7模式:

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

Important: you must put this before any other tags in <head>!

重要提示:您必须在中的任何其他标记之前放置它!

(actually you might be able to put a <title> before this, but not putting anything is easier to remember than the specific cases)

(实际上你可以在此之前放一个

,但是没有比特定情况更容易记住任何东西)</p>

#3


Check this link

检查此链接

http://ilia.ws/archives/196-IE8-X-UA-Compatible-Rant.html

Need to add a custom header as described in the link. Still looking for a non header solution when using the transitional DTD.

需要添加链接中所述的自定义标头。在使用过渡DTD时仍在寻找非标头解决方案。

#4


I think that's working as designed. I've been using that header value with no problems.

我认为这是按设计工作的。我一直在使用该标头值没有问题。

Are you having rendering issues on your pages? You could try using IE=IE7 instead.

您的网页上是否存在渲染问题?您可以尝试使用IE = IE7。

#5


found this solution... hope it works!

找到了这个解决方案...希望它有效!

Notice: You will have to put the "header" line before any html is sent to the browser (http://www.php.net/header)

注意:在将任何html发送到浏览器之前,您必须放置“标题”行(http://www.php.net/header)

It's PHP code, the line should be like this:

它是PHP代码,行应该是这样的:

header('X-UA-Compatible: IE=7');

#6


If you followed that guide too closely you will miss the fact that the web.config way of fixing this is only supported in IIS 7 +.

如果您过于仔细地遵循该指南,您将会错过这样一个事实,即只在IIS 7 +中支持修复此问题的web.config方法。

Via [MSDN] article link in OP

通过OP中的[MSDN]文章链接

Configuring Web Servers to Specify Default Compatibility Modes

配置Web服务器以指定默认兼容模式

Site administrators can configure their sites to default to a specific document compatibility mode by defining a custom header for the site. The specific process depends on your Web server. For example, the following web.config file enables Microsoft Internet Information Services (IIS) to define a custom header that automatically renders all pages in IE7 mode.

站点管理员可以通过为站点定义自定义标头,将其站点配置为默认为特定文档兼容模式。具体过程取决于您的Web服务器。例如,以下web.config文件使Microsoft Internet信息服务(IIS)能够定义自动呈现IE7模式下所有页面的自定义标头。

BUT see: IIS.NET article

但请参阅:IIS.NET文章

IIS 7.0  The <customHeaders> element of the <httpProtocol> element was introduced in IIS 7.0.

#7


    <!-- Use IE7 mode added on 13th October for IE8 BSCI-->
           <!--  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> -->
    <!-- Use IE7 mode added on 20th October for IE8 BSCI-->
            <meta http-equiv="X-UA-Compatible" content="IE=IE7" /> <!--- This appears to work on testing! -->    
            <!-- END -->   

Using 'Emulate' did not work but IE=IE7 did

使用'Emulate'不起作用,但IE = IE7