zoukankan      html  css  js  c++  java
  • 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}}}

  • 相关阅读:
    web页面中四种常见必测控件
    python03
    python基础2
    python基础
    如何定位测试用例的作用?
    需求测试的注意事项有哪些?
    性能测试的流程?
    简述bug的生命周期?
    Python字符串
    Python基础语法
  • 原文地址:https://www.cnblogs.com/sxmny/p/4103320.html
Copyright © 2011-2022 走看看