js判断本地是否安装app
<script language="javascript"> document.getElementById('openApp').onclick = function(e){ if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) { var loadDateTime = new Date(); window.setTimeout(function() { var timeOutDateTime = new Date(); if(timeOutDateTime - loadDateTime < 5000) { window.location = "https://itunes.apple.com/cn/app/id477927812"; } else { window.close(); } }, 25); window.location = "weixin:// "; } else if(navigator.userAgent.match(/android/i)) { var state = null; try { state = window.open("weixin://"); } catch(e) {} if(state) { window.close(); } else { window.location = "http://dldir1.qq.com/weixin/android/weixin656android1020.apk"; } } } </script>
判断本地是否安装了某个app,前提条件:你得知道你的APP对应的打开协议,如贴吧APP,协议为:com.baidu.tieba:// ,微信的:weixin:// ,等等。app下载链接可以到app官网找,然后用浏览器打开就行。