获取设备:
var uaContains = function (key) {
return navigator.userAgent.toLowerCase().indexOf(key.toLowerCase()) >= 0;
};
var WECHAT = ['MicroMessenger'].some(uaContains);
var ANDROID = ['Linux', 'Android'].every(uaContains); // can't just try "Android" as it might catch Windows Phone
var IOS = ['(iPhone;', '(iPod touch;', '(iPad;', '(iPod;'].some(uaContains);
获取设备并下载app:
var uaContains = function (key) {
return navigator.userAgent.toLowerCase().indexOf(key.toLowerCase()) >= 0;
};
var WECHAT = ['MicroMessenger'].some(uaContains);
var ANDROID = ['Linux', 'Android'].every(uaContains); // can't just try "Android" as it might catch Windows Phone
var IOS = ['(iPhone;', '(iPod touch;', '(iPad;', '(iPod;'].some(uaContains);
if (IOS) {
if(WECHAT ) {
window.location.assign('url');
} else {
window.location.assign("url");
}
} else if(ANDROID) {
window.location.assign('url');
} else {
window.location.assign('../');
}
window.location.assign('url');