1、使用jq判断是否用微信浏览器打开页面

var is_weixin = (function(){return navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1})();
if(is_weixin){
    return true;
}else{
    return false;
}
2、使用es6判断是否用微信浏览器打开页面

let isWeiXin = () => { return navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1 }
if (isWeiXin()) {
  return true
} else {
  return false
}

来源:https://segmentfault.com/a/1190000017389162

相关文章:

  • 2022-12-23
  • 2021-11-17
  • 2022-01-27
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-02
  • 2022-12-23
  • 2022-01-14
  • 2022-01-18
  • 2021-10-30
相关资源
相似解决方案