判断手机是安卓还是iOS及获得相应的app下载
2017-06-23 本文已影响10人
LearningCoding
var u = navigator.userAgent,
isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1,
isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
urls = {
'android':'http://www.haotoufa.com/download/hao_tou_fa_lun_tan_1.0.6.apk',
'ios':'https://itunes.apple.com/us/app/hao-tou-fa-lun-tan/id995901386?ls=1&mt=8'
};
window.location.href = isAndroid? urls.android : isiOS;