javascript 判断是否移动客户端 userAgent isMobile

javascript 判断是否移动客户端 userAgent isMobile
var isMobile = {
            Android: function () {
                return (/android/i.test(navigator.userAgent.toLowerCase()));
            },
            BlackBerry: function () {
                return (/blackberry/i.test(navigator.userAgent.toLowerCase()));
            },
            iOS: function () {
                return (/iphone|ipad|ipod/i.test(navigator.userAgent.toLowerCase()));
            },
            iPhone: function () {
                return (/iphone/i.test(navigator.userAgent.toLowerCase()));
            },
            iPad: function () {
                return (/ipad/i.test(navigator.userAgent.toLowerCase()));
            },
            iPod: function () {
                return (/ipod/i.test(navigator.userAgent.toLowerCase()));
            },
            Opera: function () {
                return (/opera mini/i.test(navigator.userAgent.toLowerCase()));
            },
            Windows: function () {
                return (/iemobile/i.test(navigator.userAgent.toLowerCase()));
            },
            any: function () {
                return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
            }
        };
javascript 判断是否移动客户端 userAgent isMobile

javascript 判断是否移动客户端 userAgent isMobile

上一篇:Android 中Attr 和TypedArray的用法


下一篇:Android基本功:ContentProvider简介