I am trying to open a native app on my webapp with javascript for ios. It works fine. But if the app not exists, I want to simulate a click to open the link in safari.
I adapt this code from stackoverflow, where element.id is the url I want to open.
setTimeout(function () {
window.location = "safari://"+element.id;
}, 5);
window.location = "instagram://"+element.id;
If instagram doesn't exist, I want to open safari. This is not working. I have the code to open outside my webapp a link in safari but also trying with window.open(element.id); fails. I guess, because I have no more ideas, I have to make a click to that link