Github项目Mobile-Detect-检测移动设备的php类

作者:matrix 发布时间:2015 年 1 月 14 日 分类:兼容并蓄

Github项目Mobile-Detect-检测移动设备的php类

Mobile-Detect php类可以检测是否为移动设备,不用你自己写代码判断ua。它使用 User-Agent 中的字符串,并结合 HTTP Header,来检测移动设备环境,比较靠谱。

网盘备份:http://pan.baidu.com/s/1pJBMFe7

Github地址:https://github.com/serbanghita/Mobile-Detect
官网:http://mobiledetect.net/
DEMO:http://demo.mobiledetect.net/

函数示例

// 载入并实例化类
require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect;
// 移动设备 (手机和平板).
if ( $detect->isMobile() )
//平板设备
if( $detect->isTablet() )
// 判断os
if( $detect->isiOS() )
if( $detect->isAndroidOS() )
...
// 其他的
$detect->is('Chrome')
$detect->is('iOS')
$detect->is('UC Browser')
...

说明:更多的函数请查看DEMO处

参考:

http://mobiledetect.net/

http://yusi123.com/2607.html

火狐修改UA插件-User Agent Switcher

作者:matrix 发布时间:2014 年 5 月 13 日 分类:兼容并蓄

火狐User Agent Switcher 插件

插件地址:http://mozilla.com.cn/addon/238-User-Agent-Switcher/

User Agent Switcher 可以快速地切换浏览器的User Agent(用户代理、ua),实现火狐的逆袭。不论是伪装成苹果的设备,还是伪装成其他版本的火狐,都没有问题。

说明:

打开上面地址安装后,工具——Default User Agent按钮,打开User Agent Switcher的菜单。

Default User Agent 表示 浏览器的默认ua

默认的UA只有几种,可以到Edit User Agent——import..    载入UA列表的XML文件。

载入UA列表的XML文件

XML文件:
baidu http://pan.baidu.com/s/1bndQah5
诚通 http://www.400gb.com/file/64546663

http://techpatterns.com/downloads/download_item.php?folder=firefox&filename=useragentswitcher.xml

平时很少用火狐浏览器,所以有些插件不是很了解。遂记录。