js判定ios/Android、ページは対応ページにジャンプします.
1747 ワード
<!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>
もちろん、リンクも対応できるのはダウンロードのページです.