About h5 Wake up app

I am waking up app with url scheme.
the requirement is that if app exists, open app, does not exist, ios jumps to appstore, Android jumps to google play.

var nowTime = new Date().valueOf();
     setTimeout(function() {
         var launchTime = new Date().valueOf() - nowTime;
         if (launchTime < 400) {
             if (checkIos()) {
                window.location.href = "https://itunes.apple.com/us/app/xxx/idxxx?mt=8";
             } else {
                window.location.href = "https://play.google.com/store/apps/details?id=xxx";
             }
        }
    }, 300);
    window.location.href = "url://url scheme";

but there is a bug. In safari, if app does not exist on the phone (it has not been downloaded yet), clicking the button will pop up a page that is not valid , followed by a pop-up of "whether to go to app store".

through Baidu, try to use iframe to request that url scheme, is ok in Android, but it doesn"t work in safari. It seems that iframe has been blocked in safari. Ask God if there is a good way to solve my problem. Thank you.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e8d2a9-46f0e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e8d2a9-46f0e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?