js判断Android和iOS
var u = navigator.userAgent;
if (u.indexOf(‘Android’) > -1 || u.indexOf(‘Linux’) > -1) {
console.log(“安卓”);
} else if (u.indexOf(‘iPhone’) > -1) {
console.log(“IOS”);
} else if (u.indexOf(‘Windows Phone’) > -1) {
console.log(“Windows Phone”);
}
js判断微信和QQ
var ua = navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i)==”micromessenger”) {
console.log(“微信”);
}else if(ua.match(/QQ/i) == “qq”){
console.log(“QQ”);
}

Logo

更多推荐