检测使用PHP的IE浏览器版本 [英] Detecting IE browser version using PHP

查看:99
本文介绍了检测使用PHP的IE浏览器版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用$ _ SERVER ['HTTP_USER_AGENT']来检测用户的浏览器。
当我在我的本地主机IE8运行的var_dump返回:
...兼容; MSIE 8.0; ...
但是,当我把它上传到我的主机(GoDaddy的),我得到:
...兼容; MSIE 7.0; ...

I'm using $_SERVER['HTTP_USER_AGENT'] to detect user's browser. When I run the var_dump on my localhost on IE8 it returns: ...compatible; MSIE 8.0; ... But when I upload it to my host (godaddy), I get: ...compatible; MSIE 7.0; ...

这是什么问题?

推荐答案

检查字符串中的字 TRIDENT 。兼容性 - 事情是在兼容模式的IE浏览器。如果你想知道这意味着什么google一下。然而,长期的三叉戟仅仅是IE8 +。

Check for the word TRIDENT in the string. The compatibility-thing is ie in compatibility-mode. Google it if you want to know what it means. However, the term trident is only ie8+.

编辑:
此外,您还可以设置一个叫头/元标记强制IE8模式(不兼容)。然而,这将可能不采取第二请求之前效果。谷歌这一点。

Also, you can set a headder/meta-tag to force ie8-mode (no compatibility). However, this will probably not take effect before the second request. Google that too.

这篇关于检测使用PHP的IE浏览器版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆