判断当前页面是通过什么设备打开

 1 let ua = window.navigator.userAgent.toLowerCase();
 2 let isWeiXin = false;
 3 let isDingTalk = false;
 4 if (ua.match(/MicroMessenger/i) == "micromessenger") {//用微信打开
 5     isWeiXin = true
 6 }else if(ua.match(/DingTalk/i)=="dingtalk"){  //用钉钉打开
 7     isDingTalk = true;
 8 } else { //用其他浏览器打开
 9     
10 }

 

posted @ 2021-03-26 17:01  最初的样子  阅读(114)  评论(0编辑  收藏  举报