判断当前页面是否在微信中

通过浏览器的navigator.userAgent内容判断当前浏览环境

function isWX(){
  var  Agent = navigator.userAgent.toLowerCase();
  return /micromessenger/.test(Agent);
}

返回值为true则表示当前的浏览环境是微信,否则不是。

原文地址:https://www.cnblogs.com/abcode/p/7519862.html