js判断微信浏览器

function is_weixin(){     //检查是否是微信浏览器
    var ua = navigator.userAgent.toLowerCase();
    if(ua.match(/MicroMessenger/i)=="micromessenger") {
	    return true;
    }else{
	    return false;
    }
}

if(is_weixin()) {
    do something...
}else{
    do something...
}
原文地址:https://www.cnblogs.com/tnnyang/p/5180937.html