JS判断设备终端(PC,iPad,iPhone,android,winPhone)和浏览器

JS判断设备终端(PC,iPad,iPhone,android,winPhone)和浏览器

var ua = navigator.userAgent;
        var browser = {},
            weixin = ua.match(/MicroMessenger\/([^\s]+)/i),
            webkit = ua.match(/WebKit\/([\d.]+)/i),
            android = ua.match(/(Android)\s+([\d.]+)/i),
            ipad = ua.match(/(iPad).*OS\s([\d_]+)/i),
            ipod = ua.match(/(iPod).*OS\s([\d_]+)/i),
            iphone = !ipod && !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/i),
            webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/i),
            touchpad = webos && ua.match(/TouchPad/i),
            kindle = ua.match(/Kindle\/([\d.]+)/i),
            silk = ua.match(/Silk\/([\d._]+)/i),
            blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/i),
            mqqbrowser = ua.match(/MQQBrowser\/([\d.]+)/i),
            chrome = ua.match(/CriOS\/([\d.]+)/i),
            opera = ua.match(/Opera\/([\d.]+)/i),
            safari = ua.match(/Safari\/([\d.]+)/i);

 

JS判断设备终端(PC,iPad,iPhone,android,winPhone)和浏览器,布布扣,bubuko.com

JS判断设备终端(PC,iPad,iPhone,android,winPhone)和浏览器

上一篇:将字符串添加到指定的文件中去 AppendAllText ;判断指定路径的文件是否存在File.Exists(Path)


下一篇:android蓝牙协议名词解释 OPP HFP HDP A2DP PAN