(ios) IOS 网页能判断有没有安装应用,安装了就打开,没安装就去appstore下载吗

请大神告知如何实现呢

判断手机/平板是否安装app 如果安装 则调用app的scheme,传入url当作参数,来做后续操作 如果没有安装 则跳转到app store/google play 下载app

function { var openUrl = window.location.search; try { openUrl = openUrl.substring1, openUrl.length; } catch e {} var isiOS = navigator.userAgent.matchiPad || navigator.userAgent.matchiPhone || navigator.userAgent.match iPod, isAndroid = navigator.userAgent .matchAndroid, isDesktop = !isiOS && !isAndroid; if isiOS { setTimeoutfunction { window.location = "itms-apps://itunes.apple.com/app/[name]/[id]?mt=8"; }, 25; window.location = "[scheme]://[host]?url=" + openUrl; } else if isAndroid { window.location = "intent://[host]/" + "url=" + openUrl + "#Intent;scheme=[scheme];package=[package_name];end"; } else { window.location.href = openUrl; }
};

http://blog.csdn.net/iunion/article/details/10327665/ 可以参考下

谢谢 我到时试一试

发表评论

电子邮件地址不会被公开。 必填项已用*标注