<a href="http://www.test.com/laoqu.apk">a标签 点击下载</a>
<div class="mui-btn-block" onclick="javascript:window.location.href = ‘http://www.test.com/laoqu.apk‘">onclick事件 点击下载</div>
<div id="myBtn" class="mui-btn-block">id选择器 点击下载</div>
<div class="mui-btn-block querySelector">类选择器 点击下载</div>
<script type="text/javascript">
//部分手机浏览器不支持tap事件,所有用click
//类选择器点击后打开
document.querySelector(".querySelector").addEventListener("click", function () { window.location.href = "http://www.test.com/laoqu.apk" });
//id选择器点击后打开
//document.getElementById("myBtn").addEventListener("click", function () { window.location.href = "http://www.test.com/laoqu.apk" });
//不用点击直接打开
//window.location.href = "http://www.test.com/laoqu.apk";
</script>
原文地址:https://www.cnblogs.com/net5x/p/8981301.html