JavaScript 区分IOS/安卓 跳转下载

简单做一下前端判断,根据设备跳转不同的下载环境

1
2
3
4
5
6
var u = navigator.userAgent;
if(!!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)){
window.location.href='https://itunes.apple.com/cn/app/App Store下载地址';
}else {
window.location.href='http://android.myapp.com/myapp/应用宝下载地址';
}

Powered by Hexo and Hexo-theme-hiker

Copyright © 2017 - 2023 Keep It Simple And Stupid All Rights Reserved.

访客数 : | 访问量 :