js判断页面是什么设备打开的

function getBrowse() {
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
     //在微信客户端打开
}

if (ua.match(/WeiBo/i) == "weibo") {

   //在新浪微博客户端打开

 }

 if (ua.match(/QQ/i) == "qq") {

 //在QQ空间打开

}

if (/android/i.test(ua)) {
//在android上打开

} else if (/mac os x/i.test(ua)) {
//在ios上打开

}

原文地址:https://www.cnblogs.com/szxlh/p/5045813.html