封装判断浏览器方法

/*判断浏览器
1:企业微信
2:微信
3:其他浏览器
*/
export function isWeixn() {
    
    
  const ua = navigator.userAgent.toLowerCase();
  const isWeixin = ua.indexOf('micromessenger') != -1;
  const isQYWeixin = ua.indexOf('wxwork') != -1;
  if (isQYWeixin && isWeixin) {
    
    
    return 1;
  } else if (isWeixin && !isQYWeixin) {
    
    
    return 2;
  } else {
    
    
    return 3;
  }
}

猜你喜欢

转载自blog.csdn.net/weixin_47541876/article/details/128287891