判断是否为微信环境下打开的网页

非微信浏览器条件下隐藏某些东西:

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();
原文地址:https://www.cnblogs.com/dztHome/p/10066148.html