How do I set X-UA-Compatible header to IE=EmulateI

2019-02-19 11:31发布

问题:

I am able to set this header

X-UA-Compatible "IE=EmulateIE7"

using the following directive in my Apache 2.0 httpd.conf file:

<Location /mypath>
   Header set X-UA-Compatible "IE=EmulateIE7"
</Location>

How can I configure Apache to only set this header for IE 8 browsers?

回答1:

This is the best I could come up with so far. It seems to work. If anyone has a better way, please let me know.

BrowserMatch "^.*MSIE 8.*$" emulate_ie7

<Location /mypath>
   Header set X-UA-Compatible "IE=EmulateIE7" env=emulate_ie7
</Location>