How do I set different options for X-UA-Compatible in Apache for IE8 and IE9?

旧街凉风 提交于 2020-01-06 09:12:47

问题


I was facing issue with rendering big tables in IE8 (See this) it goes really slow and hangs. This was working correctly in IE7 so to solve it I have used Header add X-UA-Compatible IE=EmulateIE7 in my Apache httpd.conf file and now it all works fine. I also use IE9 and my site works fine with adding HEADER for IE7 emulation. But with this fix IE9 is also using EmulateIE7 I would rather like it to use IE9 rendering engine. I want IE8 to use IE7 rendering engine and IE9 to use IE9 rendering engine.

Does anyone know how this can be done with the same site? Adding another entry in same fix doesn't work.


回答1:


I don't think you can specify this in Apache - you're trying to do logic based on the User Agent, which is unreliable. The better way to do this is on a per-page evaluation. You might need to use something like this:

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

Something to read: Emulate IE7 for IE8 but not for IE9 using "X-UA-Compatible"




回答2:


Yes we can do it, plase ref: Set server level response header

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

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



来源:https://stackoverflow.com/questions/13189817/how-do-i-set-different-options-for-x-ua-compatible-in-apache-for-ie8-and-ie9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!