JavaScript 判断是否微信浏览器

function is_weixn(){
var ua = navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i)=="micromessenger") {
return true;
} else {
return false;
}
}

if( is_weixn() ) {
document.write("微信浏览器")
} else {
document.write("其他浏览器")
}

posted @ 2021-01-23 10:06  MartinSteven  阅读(64)  评论(0)    收藏  举报