1. 程式人生 > >判斷是否為微信環境下打開的網頁

判斷是否為微信環境下打開的網頁

網頁 mes tel doc 微信瀏覽器 agent mic tolower fun

非微信瀏覽器條件下隱藏某些東西:

function isWeiXin(){
        var ua = window.navigator.userAgent.toLowerCase();
        if(ua.match(/MicroMessenger/i) == ‘micromessenger‘ || ua.match(/_SQ_/i) == ‘_sq_‘){
            return true;
        }else{
            document.getElementById("follow").style.visibility="hidden"; 
           
return false; } } isWeiXin();

判斷是否為微信環境下打開的網頁