在瀏覽器裡判斷裝置來源,跳轉到不同的App下載頁JS
阿新 • • 發佈:2019-01-01
$(function () {
$(".btn-download").click(function () {
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android終端
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios終端
if (isAndroid) {
location.href = "http://static.tuicaiba.com/app/V1.5.5/tuicaiba-1.5.5-tuicaiba.apk";
}
else if (isiOS) {
location.href = "itms-apps://itunes.apple.com/app/id你的appid";
}
})
});
$(".btn-download").click(function () {
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android終端
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios終端
if (isAndroid) {
location.href = "http://static.tuicaiba.com/app/V1.5.5/tuicaiba-1.5.5-tuicaiba.apk";
}
else if (isiOS) {
location.href = "itms-apps://itunes.apple.com/app/id你的appid";
}
})
});