暂时只判断了android或ios终端,对于微信浏览器没有做相对应处理,但是通过else也可以进行判断跳转其他链接
downApp() {
let ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf('Android') > -1 || ua.indexOf('Adr') > -1;
//android终端
var isiOS = !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
if (isiOS) {
//ios
window.location.href = 'https://itunes.apple.com........'
} else{
// android
window.location.href = 'http://..........'
}
},
网友评论