如何在Apache for IE8和IE9中为X-UA-Compatible设置不同的选项?

时间:2012-11-02 05:29:02

标签: html apache browser internet-explorer-8

我遇到了在IE8中渲染大表的问题(参见this)它真的很慢并且挂起。这在IE7中正常工作,所以为了解决它我在我的Apache Header add X-UA-Compatible IE=EmulateIE7文件中使用了httpd.conf,现在一切正常。我也使用IE9,我的网站可以正常工作,为IE7仿真添加HEADER。但是通过这个修复IE9也使用EmulateIE7我更喜欢使用IE9渲染引擎。我希望IE8使用IE7渲染引擎和IE9来使用IE9渲染引擎。

有谁知道如何使用同一个网站完成此操作?在同一个修复程序中添加另一个条目不起作用。

2 个答案:

答案 0 :(得分:4)

我不认为你可以在Apache中指定它 - 你正在尝试根据用户代理做逻辑,这是不可靠的。更好的方法是进行每页评估。您可能需要使用以下内容:

<meta http-equiv="X-UA-Compatible" content="IE=7, IE=9">

要阅读的内容:Emulate IE7 for IE8 but not for IE9 using "X-UA-Compatible"

答案 1 :(得分:2)

是的,我们可以做到,请参考: 设置服务器级响应标头

1. Open httpd.conf in a text editor

2. Uncomment (or add)  “LoadModule headers_module modules/mod_headers.so”

3. Add the following configuration fragment at the end of the httpd.conf file:

<IfModule headers_module>

   Header set X-UA-Compatible: IE=EmulateIE7

</IfModule>

4. Save httpd.conf file

5. Restart the Apache server

6. Browse the test web page

参考链接: http://blogs.msdn.com/b/hanuk/archive/2008/08/28/apache-httpd-configuration-for-ie7-standard-mode-rendering-in-ie8.aspx

相关问题