-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't work on iOS 9 #16
Comments
I can confirm that it doesn't work on iOS 9. Works fine on iOS 8.4.1. It seems that the following doesn't get executed: iframe.onload = function() {
clearTimeout(timeout);
iframe.parentNode.removeChild(iframe);
window.location.href = uri;
}; |
iOS 9 added privacy features where apps can't navigate or "detect" apps installed --assuming this affected safari as well :/ having a link like |
Even just assigning |
The below approach fixes this issue: |
Can we expect fixing of this issue soon? |
@omihailo As @sgtpepper43 already mentioned, Apple likely expects you to implement universal links (see the WWDC talk). As long as your app is not an app launcher or something, implementing universal links is likely the way to go, since Apple seems to conceptually treat hitting Safari as the “no deeplink recognized” fallback. Differently stated: Safari conceptually doesn’t expect automatically triggered deeplinks, since universal links are recognized before the page is fully loaded in Safari. |
as @shailu highlighted, here's the quick fix for this issue: var ua = window.navigator.userAgent;
if (ua.match(/CriOS/) || (ua.match(/Safari/) && ua.match(/Version\/9/))) {
//do another approach...
document.location = uri;
} else {
var iframe = document.createElement("iframe");
iframe.onload = function() {
clearTimeout(timeout);
iframe.parentNode.removeChild(iframe);
window.location.href = uri;
};
iframe.src = uri;
iframe.setAttribute("style", "display:none;");
document.body.appendChild(iframe);
} |
@kennyth01, unfortunately as @shailu mentioned, the workaround causes an error dialog to appear if the user doesn't have your app installed. Unfortunately that's a non-starter for us. The only real solution for us is to use Universal Links. |
@andyvb what do you mean by "error" dialog? I didn't saw any error dialog? Edited: saw it already, disregard this post. But I think it should be okay to have that for as long as you combine deep-linking with a custom smart app banner. |
@kennyth01 It's in the ticket shailu linked to (mderazon/node-deeplink#9). You see this dialog if you don't have the app installed: Edited: There's no way to absolutely prevent the user from seeing that dialog regardless whether you have a smart app banner. The slightly better UX is to trigger the script from some user interaction like when they tap a button on the web page like, "hey open the page in my app". The problem is they'll see the error dialog if you don't have the app installed. There is no workaround with pure Javascript to 100% prevent the error dialog. The best UX that supports deep linking across iOS versions is:
|
The best solution I found is to:
With this solution, if the app is not installed, an error dialog is thrown, but after clicking OK another dialog appear with the question "Open App store?". I print also a small HTML with a link to the fallback, in the case the user clicks "Cancel" of the dialogs. |
ios 9.2 has made things worse. see this blog post |
From the link:
Wasn't this the case even in ios 9.0? |
In iOS 9.0, setting a new URL after the "non-blocking modal" cause the dialog box to be dismissed as if user clicked "Open", which is useful behavior. In 9.1, the app launch dialog box is blocking, while the error dialog box is non-blocking. In 9.2, both dialog boxes are non-block. Also setting a new URL causes dialog box to be dismissed as if user clicked "Cancel", which is does not help the cause. |
@kopiro: Is there any way to detect user click on cancel button in the popup so that we can directly redirect to the fallback url without printing the small html page. |
I think you cant, it's an OS dialog you can't just control. |
For user action, you can guess using Also there is slight difference in |
@leonyu this could be a nice hack (but apple is annoying with this changes....) |
I'm closing this because it's been three years and I don't want to see this in my issues list anymore 😁 Plus as of b0bd1cf this project is no longer maintained. |
Trying to open the link always fails on iOS 9, whether you have the app or not.
The text was updated successfully, but these errors were encountered: