判断手机浏览器的方法;

 

//判断手机浏览器的方法
var mbType = {};
var
ua = navigator.userAgent;
mbType.webkit = ua.match(/WebKit\/([\d.]+)/);
mbType.android = ua.match(/(Android)\s+([\d.]+)/);
mbType.ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
mbType.iphone = !mbType.ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
mbType.ipod = ua.match(/(iPod.*OS)\s([\d_]+)/);
mbType.webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/);
mbType.blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/);
mbType.uc_webkit = ua.match(/UC\sAppleWebKit\/([\d.]+)/);
mbType.uc_proxy = ua.match(/(UCWEB)(\d.+?(?=\/))/);
mbType.qq = ua.match(/(MQQBrowser)\/(\d.+?(?=\/ |\sMozilla)).*AppleWebKit\/([\d.]+)/);
mbType.wp7 = (ua.indexOf('WP7') > -1) || (ua.indexOf('Windows Phone OS') > -1);
console
.log(mbType.webkit);
console
.log(mbType.android);
console
.log(mbType.ipad);
console
.log(mbType.blackberry);
console
.log(mbType.webos);
console
.log(mbType.uc_proxy);