linzy

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
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());
            }
        };

 

posted on 2014-02-17 14:41  linzy  阅读(865)  评论(0编辑  收藏  举报