简体   繁体   中英

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

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.

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"

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM