网页推荐下载App,如果本地已安装则直接打开本地App
function open_or_download_app() { if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) { // 判断useragent,当前设备为ios设备 var loadDateTime = new Date(); // 设置时间阈值,在规定时间里面没有打开对应App的话,直接去App store进行下载。 window.setTimeout(function() { var timeOutDateTime = new Date(); if (timeOutDateTime - loadDateTime < 2000) { window.location = "https://itunes.apple.com/cn/app/hu-lu/id627370076?mt=8"; } else { window.close(); } }, 50); window.location = "XXX://"; // iOS端URL Schema } else if (navigator.userAgent.match(/android/i)) { // 判断useragent,当前设备为android设备 window.location = "XXX://"; // Android端URL Schema } }
相关推荐
liuxudong00 2020-11-19
wwzaqw 2020-11-11
lihaoxiang 2020-11-05
CrossingX 2020-11-04
xuegangic 2020-10-17
86417413 2020-11-25
83206733 2020-11-19
86276537 2020-11-19
83266337 2020-11-19
86256434 2020-11-17
zhouboxiao 2020-11-16
rise 2020-11-22
sssdssxss 2020-11-20
windle 2020-11-10
孙雪峰 2020-10-30
85477104 2020-11-17
xfcyhades 2020-11-20
cheidou 2020-11-19