首页 > 代码库 > js判断客服端

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
                },

js判断客服端