PHP检测Internet Explorer中低于10版 [英] PHP detect Internet Explorer that is below version 10

查看:104
本文介绍了PHP检测Internet Explorer中低于10版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能为我做到这一点?由于我只有Mac和不能测试IE浏览器。

Could someone do this for me? As I only have macs and cannot test IE.

什么是如果浏览器是Internet Explorer中运行事件的一个很好的方式,并且版本是在10所以说这是IE 7,它会显示错误,或者如果它的IE 9.9,它会显示错误,但是如果是IE 10,10.1,10.0.1等也不会显示错误。

What's a good way of running an event IF the browser is Internet Explorer, and the version is under 10. So say it's IE 7, it will show the error, or if it's IE 9.9, it will show the error, however if it's IE 10, 10.1, 10.0.1 etc it will not show the error.

推荐答案

函数的 get_browser()的可用于特征检测

The function get_browser() may be used for feature detection.

如果你真的想只知道用户的浏览器版本,你可以看一下 $ _ SERVER ['HTTP_USER_AGENT']

If you really want to only know the user's browser version you can look at the $_SERVER['HTTP_USER_AGENT'].

注意的一点是:虽然大多数用户都无法做到这一点,就可以发送不同的用户代理字符串可能会做如服务器保护那些隐私。如果有人想尽可能向您发送用户代理,能够使用你的网站去,虽然他们可能会知道如何应对可能出现的任何错误。

A word of caution: although most users won't do this, it is possible to send a different user agent string to the server which might be done to e.g. protect ones privacy. If someone wants to go as far as sending you a user agent to be able to use your website though they'll probably know how to deal with any bugs that may come up.

作为一个方面的问题,什么是你想要你的听众限制在IE 10和最多的原因是什么?为什么不使用的库如 Modernizr的填写功能,你可以在IE 9会丢失?

As a side question, what is the reason you're trying to limit your audience to IE 10 and up? Why not use a library such as Modernizr to fill in functions you might be missing in IE 9?

编辑:
关于IE的一些信息10用户代理字符串。您将要阅读,让你知道什么反对

Some info regarding the IE 10 user agent string. You will want to read that so you know what to match your $_SERVER['HTTP_USER_AGENT'] against

这篇关于PHP检测Internet Explorer中低于10版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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