美文网首页
判断微信内置浏览器, 其他浏览器

判断微信内置浏览器, 其他浏览器

作者: 追逐时光的光光 | 来源:发表于2018-05-10 17:03 被阅读0次

通过获取浏览器的userAgent, 进行判断

var userAgent = navigator.userAgent.toLowerCase(); 

if(userAgent .match(/MicroMessenger/i)==”micromessenger”) {

    alert("weixin"); 

}

if(userAgent .match(/android/i)) == "android") {  

    alert("android");  

}  

if(userAgent .match(/iPhone/i)) == "iPhone"){  

    alert("iPhone");  

}  

if(userAgent .match(/iPad/i)) == "iPad"){  

    alert("iPad");  

相关文章

网友评论

      本文标题:判断微信内置浏览器, 其他浏览器

      本文链接:https://www.haomeiwen.com/subject/umhtdftx.html