简体   繁体   English

如何仅针对IE 9在.htaccess中设置HTTP标头

[英]How to set HTTP headers in .htaccess only for IE 9

I am not able to find and way to set some header in .htaccess file only if the browser is IE9. 仅当浏览器是IE9时,我才能找到并在.htaccess文件中设置一些标头的方法。 Pseudo code for my requirement is: 我的要求的伪代码是:

if (IE 9) {
    header set (value)  
} else {
    header set (value)
}

Please suggest how I can achieve this in my .htaccess file. 请建议我如何在我的.htaccess文件中实现此目的。

I got the solution after reading bunch of lines in Apache doc :) .Just include these lines in htaccess, Its working fine for me. 我在阅读了Apache doc :)中的一堆行后得到了解决方案。只需在htaccess中包含这些行,它对我来说很好。

BrowserMatch "MSIE 9.0"  ie9
header set X-UA-Compatible "IE=EmulateIE8" env=ie9

根据这篇文章 <meta http-equiv="X-UA-Compatible" content="IE=8" />应该会给你想要的结果,无论你使用的是哪个版本的IE。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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