ua判断页面在什么终端/系统打开

1 function isIOS() {
2     return /ios|iPhone|iPad/ig.test(window.navigator.userAgent);
3 }


4 function isAndroid() { 5 return /android/ig.test(window.navigator.userAgent); 6 }



7 function isWeiXin() { 8 return /MicroMessenger/ig.test(window.navigator.userAgent); 9 }

 

 

 

        var ua = window.navigator.userAgent.toLowerCase();
        if(ua.match(/micromessenger/i)=="micromessenger") { 
            alert('wx');  //在微信打开
        }else if(ua.match(/qq/i)=="qq"){
            alert('qq');   //在QQ打开
        }else {
            alert('browser');  //浏览器
        }

  

posted @ 2017-08-01 10:09  rrranmo  阅读(204)  评论(0编辑  收藏  举报