在下载app的时候,往往IOS端和安卓端的下载地址链接是不一样的,这个时候就需要判断当前设备是IOS还是安卓:
downLoad() {
var u = navigator.userAgent;
var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //安卓端
var isIos = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //IOS端
if (this.weixn()) {
this.weiprompt = true;
} else {
if (isIos) {
window.location.href ="";
} else {
window.location.href = "";
}
}
}
}
判断是否是微信内置浏览器:
weixn() {
//判断是否在微信浏览器中
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
return true;
} else {
return false;
}
}