We have a page that opens the installed application to the user or sends him to the AppStore. Everything was built around top.location.href = "{appscheme}://?" + params; and timeout for redirecting into Appstore. Recently, this approach has stopped working correctly when opening page in Istagram. When trying to open the app, the user sees the message There was a problem while loading this website even though the app is installed.
I tried to change the link to top.location.href = "{appscheme}://{appscheme}?" + params; and the application really started to open, but if the application is removed, then the page opens/closes quickly and the redirect to the AppStore does not have time to work out. How to determine that the application is installed or prevent the opened page from closing?
What was done?
window.openHow to reproduce: iOS(15.2), open page in Instagram native browser(open link through insta messages etc), inside loaded page try to open application via JS