I need a redirect to a native iOS application, if the application is not installed, then a redirect to the App Store.
I already tried different methods like window.location.replace() and iframe with app url in src.
window.location.replace("MyIOSAPP://") is causing native safari modal with error, then nothing happends, I tried to catch that with trycatch construction, it doesn't get caught in the catch callback.
I also tried <iframe/>
const iframe = document.createElement("iframe");
iframe.style.border = "none";
iframe.style.width = "1px";
iframe.style.height = "1px";
iframe.onload = function () {
document.location = "MyIOSAPP://";
};
iframe.src = "MyIOSAPP://"; //iOS app schema url
document.body.appendChild(iframe);
setTimeout(function () {
window.location.href = "appstore url"; //fallback url
}, 300);
Link to MyIOSAPP:// is ignored, the setTimeout callback fires and I am being redirected to App Store without trying to open the native iOS app.
Please, help me solve this problem