Prior to iOS 9, one method of determining whether an app was installed on an iPhone using javascript involved utilizing a custom URI scheme followed by a timeout:
window.location = "yourapp://";
setTimeout(function() {
window.location = "https://yourdomain.com";
}, 25);
If the app was installed, it would launch and prevent the timeout from triggering since javascript execution halts when the app opens.
However, in Safari on iOS 9 and above, the line
window.location = "yourapp://";
triggers a popup prompting the user to decide whether to open the app. Consequently, javascript continues executing, causing the timeout to run before the app opens, leading to the App Store opening instead.
In summary - In iOS 9 and later versions, within Safari, even if the app is installed, this code will still redirect to the App Store. Therefore, this approach is no longer effective for checking app installation status.
Is there an alternate method to determine if an app is installed on an iPhone running iOS 9 or newer using Javascript on a webpage?