4

Before anyone marks this question as a duplicate please read the extra section at the bottom that sites differences between this question and other similar questions out there

I'm utilizing Universal Links for my deep linking needs. Two example use cases are:

1.) Safari/Chrome Browser on iPhone with my app installed: When click on a link on my web site on their iPhone I'm deep linking them into my app if installed on their phone.
2.) With my app installed, running my app but using an in-app-UIWebView. My app also has an in-app UIWebView, when you tap a button it deep links them somewhere in the application.

After you deep link into the app, there are two buttons in the navigation bar. A Back button (top left) and a Forward button (top right).

My problem

If the user presses the forward button (top right) it forwards them to my web page and then will forever break my deep linking so that any time in the future when the user clicks on that link to deep link it always goes to my web page instead of deep linking into the app (which was the original intention). How can I prevent this? My concern here is that my app has close buttons in the top right corner and if the user is trying to hit hte close button they could accidentally hit the forward button and forever break deep linking. I've tried clearing my browsers caches, I've tried deleting and re-installing my app. But nothing will "fix" deep linking after it's been permanently disabled by the forward button. The only way I can get it working again is by doing a complete device reset and Erasing all Content and Settings.

Here is an image of the back and forward buttons after deep linking into the application.

Difference between my question and similar questions on SO:

Similar SO question But here they are saying that the user can long-press on the "universal link" and and action sheet pops up asking you to "open in ". I've tried this for above case 1.) and my app isn't showing up in the options. See attached screenshot below. And this doesn't work at all for above case 2.). How do you get a Universal link to work with an iOS WebViewController? Do I have to use the SafariViewController? I don't want to use SafariViewController in my app for this case because I don't want to have that top navigation bar that SafariViewController has.

enter image description here

Community
  • 1
  • 1
LampShade
  • 2,675
  • 5
  • 30
  • 60
  • I think you can pull down the website content to expose a banner saying 'open in ... app' then tap the open button to return to the app. The OS will remember this choice like it does with the status bar breadcrumb link. EDIT: I'm unsure if you can prevent it from happening, universal links are supposed to work on both browsers and native apps, and the user's pick will be honored. I might be wrong on this one though. – Zoltán Lippai May 11 '16 at 19:25
  • I understand honoring the user's pick. But the UI/UX for the forward button is horrible. Placing it so close to the Close button for most apps (top right). So you're saying universal links should work in a native app UIWebView? Mine aren't for some reason, trying to figure out why... I don't want to use SafariViewController because I don't want it's top and bottom navigation bars to be shown. – LampShade May 11 '16 at 19:49

2 Answers2

2

You're absolutely right: the forward button is horrible UI/UX. It's one of the big flaws with Universal Links identified in this blog post. There is no way to disable the forward button, and once it's triggered, you're screwed.

The easiest way to re-enable Universal Linking behavior after it is turned off is to long-press on the link. But that doesn't work if your link is being disabled by the system based on some other criteria (more details below). Your best bet at getting a clean shot is to paste the Universal Link URL into the stock Notes app and try long-pressing it from there.

To answer a few of your other questions:

  • Universal Links do work within UIWebView (per Apple's docs). A SafariViewController is not necessary.
  • Universal Links are disabled at the system level in certain situations. There's a list here, but this the main one that comes to mind as potentially applicable in this situation:

Universal Links will not work with a user driven element click on the same domain. Example: if there is a Universal Link on google.com pointing to a different Universal Link on google.com, it will not open the app.

  • Your second example image is from Chrome. Universal Links should work (conditionally) in Chrome, but is the link pointing at the same domain as the page you've already loaded? If so, that's why you aren't seeing the Open in [app] option.
Alex Bauer
  • 13,147
  • 1
  • 27
  • 44
0

You cannot disable the button to open the website, but you can create a path in the other direction: Use a smart banner on the website, and when users tap "Open" (or the localized equivalent), they will be taken back to your app, and this will also reset the default to opening universal links in your app instead of Safari.

hagi
  • 11,503
  • 3
  • 35
  • 48