Internet Explorer 11专用代码

时间:2014-05-08 18:38:22

标签: internet-explorer-11

我正在尝试为我的网站客户端插入一个专门用于IE11的代码,IE11以错误的方式生成DIV(但不能在任何其他浏览器中生成)。当我拿起浏览器在浏览器中显示时,IE11说Mozilla 5.0 ......什么?

我正在使用:

if (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false) {
echo '<div style="position:relative; top:-15px;">';
  }

[非IE代码]

if (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false) {
echo '</div>';
  }

帮助?

1 个答案:

答案 0 :(得分:0)

这可能有所帮助。

IE 11更改了用户代理字符串,这就是您在输出浏览器用户代理字符串时看到MOzilla / 5.0的原因。有关更多信息

IE 11 sends different User-Agent header to different subdomains

http://msdn.microsoft.com/en-us/library/ie/hh869301%28v=vs.85%29.aspx