您的位置:首页 > 移动开发 > IOS开发

js判断ios/Android,页面跳至对应页面

2015-12-14 16:07 501 查看
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,user-scalable=no">
<title>指尖贷-借贷理财神器</title>
<style type="text/css">
a{ text-decoration: none;}
img{ display: block; margin: 0 auto; width: 100%; border: 0;}
.btn{ width: 100%; position: fixed; bottom: 0; min-width: 320px;  background: #fefefe;  padding: 12px 0;
color: #fff; text-align: center; line-height: 45px; border-radius: 3px; border-top: 1px solid #dcdcdc;
}
.btn a{ height: 45px; background:#25cffb ; color: #fff; display: block; width: 90%; margin: 0 auto; font-size: 18px; font-weight: bold;}
</style>
</head>
<body>
<a href="javascript:void(0)" onclick="jump()">
<img src="images/mayp-151214.jpg" />
</a>
<div class="btn">
<a href="javascript:void(0)" onclick="jump()">
立即下载
</a>
</div>
<script src="jquery-1.9.1.min.js"></script>
<script type="text/javascript">
function jump(){
var u = navigator.userAgent, app = navigator.appVersion;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
if(isAndroid==1){
window.location.href="Android.html"
}
else(
window.location.href="ios.html"
)
}
//		alert('是否是Android:'+isAndroid);
//		alert('是否是iOS:'+isiOS);
</script>
</body>
</html>

当然,链接也可以相对应的是下载的页面
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  javascript ios android