<button class="openApp">立即下载</button> 页面按钮
//判断安装app,有跳转,无则跳至下载页面
$(".openApp").click(function(){
if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)){
window.location.href = "url://xxx?xx="+${xx}"; //ios app协议(如:com.baidu.tieba://)
window.setTimeout(function() {
window.location.href = "https://a.app.qq.com/o/simple.jsp?pkgname=xxx"; //跳转到App store
}, 3000)
}
if(navigator.userAgent.match(/android/i)){
window.location.href = "url://xxx?xx="+${xx}; //android app协议(如:com.baidu.tieba://app)
window.setTimeout(function() {
window.location.href = "https://a.app.qq.com/o/simple.jsp?pkgname=xxx"; //android 下载地址
}, 3000) //先通过协议打开APP 如果超过三秒没响应,则跳到应用宝商城下载
}
})