方案一:推荐
var ua = navigator.userAgent.toLowerCase();
var isWinxin = ua.indexOf(‘micromessenger‘) != -1;
if(isWinxin){
return true;
}else{
return false;
}
方案二:
function is_weixin(){
var ua = navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i) == ‘micromessenger‘){
return true;
}else{
return false;
}
}
搬运代码http://www.cnblogs.com/wenzheshen/p/6018976.html