Can IOS web pages judge whether an application is installed, open it when installed, and download it from appstore when not installed?

  ios, question

Please tell the great god how to realize it

Judging whether the mobile phone/tablet is installed with app; if so, calling the app scheme, and passing in url as a parameter to do subsequent operations; if not, jumping to app store/google play to download app

(function () {
    var openUrl =;
    try {
        openUrl = openUrl.substring(1, openUrl.length);
    } catch (e) {}
    var isiOS = navigator.userAgent.match('iPad') || navigator.userAgent.match('iPhone') || navigator.userAgent.match(
        isAndroid = navigator.userAgent
        isDesktop = !isiOS && !isAndroid;
    if (isiOS) {
        setTimeout(function () {
            window.location = "itms-apps://[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;