js判断是否为微信浏览器

function is_weixn(){

  var ua = navigator.userAgent.toLowerCase();
  if(ua.match(/MicroMessenger/i)=="micromessenger") {
    return true;
  } else {
    return false;
  }
}
var wx = is_weixn();
if(wx == false){
  window.location.href = "wxError.html"
}
posted @ 2018-11-01 15:36  Echo的前端空间  阅读(136)  评论(0编辑  收藏  举报