1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 检测浏览器是pc端还是移动端 是否微信浏览器

检测浏览器是pc端还是移动端 是否微信浏览器

时间:2020-05-05 21:39:27

相关推荐

检测浏览器是pc端还是移动端 是否微信浏览器

judgeTerrace() {//检测平台let p = navigator.platform;this.system.win = p.indexOf("Win") == 0;this.system.mac = p.indexOf("Mac") == 0;this.system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);this.system.ipad = (navigator.userAgent.match(/iPad/i) != null) ? true : false;let ua = navigator.userAgent.toLowerCase();if (this.system.win || this.system.mac || this.system.xll || this.system.ipad) {if (ua.match(/MicroMessenger/i) == "micromessenger") {// console.log('在PC端微信上打开的');this.ismobileWeiXin = false} else {// console.log('在PC端非微信上打开的');this.ismobileWeiXin = false}} else {if (ua.match(/MicroMessenger/i) == "micromessenger") {// console.log('在手机端微信上打开的');this.ismobileWeiXin = true} else {// console.log('在手机上非微信上打开的');this.ismobileWeiXin = true}}}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。