微信扫二维码根据系统下载apk

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
<title>下载apk</title>
<!--<link rel="stylesheet" href="css/bybstyle.css"/>-->
<link rel="stylesheet" href="css/reset.css"/>
<script src="js/jquery-1.8.0.min.js" type="text/javascript" charset="utf-8"></script>
<style type="text/css">
html, body {
margin:0;
padding:0;
height:100%;
overflow: hidden;
}
.wxts {
display: none;
100%;
height:100%;
position:absolute;
z-index: 999;
background:rgba(0, 0, 0, 0.6);
filter:alpha(opacity=80);
overflow: hidden;
}
.img {
position: absolute;
100%;
height:100%;
100%;
height:100%;
}
.zi {
85%;
height: 6em;
margin-top:3em;
margin:auto;
}
.zi img {
100%;
}
.main {
100%;
height: 100%;
overflow: hidden;
}
#anzhuoBtn {
80%;
height: 3.2em;
display: inline-block;
background: #70d1ef;
border-radius: 3px;
text-align: center;
line-height: 3.2em;
color: #FFFFFF;
}
.topCent {
height: 19em;
100%;
text-align: center;
margin-bottom: 5%;
margin-top: 0%;
background: url("img/weixinkeke.jpg") no-repeat center;
background-size: cover;
display: block;
}
</style>
</head>
<body>
<div class="wxts" id="wxts">
<div class="zi">
<img src="img/xxxmgs.png">
</div>
<div class="img"></div>
<!--提示图片-->
</div>
<div class="main">
<p class="topCent"></p>
<div style=" 60%;margin: auto;">
<p style="text-align: center;margin: 2em 0 1em 0;"><a id="anzhuoBtn" href="#">点击下载</a>
</p>
</div>

</div>

<script type="text/javascript">
//判断是否为微信浏览器
function isWeiXin() {
var ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
return true;
} else {
return false;
}
}
document.addEventListener("DOMContentLoaded", function (c) {
if ((navigator.userAgent.match(/(Android)/i))) { //android系统执行

window.location.href = "xxxx" //安卓下载链接
} else {
if ((navigator.userAgent.match(/(iPhone|iPod|ios|iPad)/i))) { //ios系统执行
//alert("ios敬请期待")// ios 下载链接
window.location.href = "xxxx"; //ios跳转appstore商店
} else {
//alert("无法识别您的系统") //非android/ios系统
}
}
document.addEventListener("WeixinJSBridgeReady", function a() {
WeixinJSBridge.call("hideToolbar");
WeixinJSBridge.call('showOptionMenu');
$('#anzhuoBtn').on('click', function () {
document.getElementById('wxts').style.display = "block"; // 显示提示在浏览器打开
})
});
window.addEventListener("orientationchange" in window ? "orientationchange" : "resize", function (d) {},
false);
},false);
</script>
</body>
</html>

原文地址:https://www.cnblogs.com/S-pcholder/p/5178192.html