js判断客服端

 ua: function () {
                    return navigator.userAgent.toLowerCase()
                },
                isMobile: function () {
                    return M.ua().match(/iPhone|iPad|iPod|Android|IEMobile/i)
                },
                isAndroid: function () {
                    return -1 != M.ua().indexOf("android") ? 1 : 0
                },
                isIOS: function () {
                    var a = M.ua();
                    return -1 != a.indexOf("iphone") || -1 != a.indexOf("ipad") || -1 != a.indexOf("ipod") ? 1 : 0
                },
                platform: function () {
                    return M.isMobile() ? M.isIOS() ? "IOS" : M.isAndroid() ? "Android" : "other-mobile" : "PC"
                },
                isWeixin: function () {
                    return -1 != M.ua().indexOf("micromessenger") ? 1 : 0
                },
                isWeixinPay: function () {
                    if (M.isWeixin()) {
                        var a = M.ua(),
                        b = a.substr(a.indexOf("micromessenger"), 18).split("/");
                        return Number(b[1]) >= 5 ? 1 : 0
                    }
                    return 0
                },

 

 

--------2345的判断

var ua=navigator.userAgent,mobileAgents=['Windows CE','iPod','Symbian','iPhone','BlackBerry','Android','Windows Phone','webOS'];for(var i=0;i<mobileAgents.length;i++){if(ua.indexOf(mobileAgents[i])!==-1){location.href='http://m.2345.com/';return}}}

posted @ 2014-11-17 12:47  伤心木乃伊  阅读(118)  评论(0编辑  收藏  举报