Skip to content
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

A solution for following deep links #182

Open
terreng opened this issue Aug 5, 2021 · 0 comments
Open

A solution for following deep links #182

terreng opened this issue Aug 5, 2021 · 0 comments

Comments

@terreng
Copy link

terreng commented Aug 5, 2021

Great plugin, but one issue with using an in app browser is that it doesn't follow universal/deep links to other apps. It's not a great experience using a website like youtube.com in the in app browser instead of just opening the link in the YouTube app.

This isn't a problem with this plugin, but rather a limitation of SafariViewController / custom Chrome tabs.

So today I created cordova-plugin-open-app-link. This plugin checks if there's an app installed to handle the link, and opens it if so. Otherwise it returns false (and doesn't do anything), which allows you to use SafariViewController as a fallback.

Here's an example of how to use it with your plugin:

OpenAppLink.open(url, function(opened) {
  if (!opened) {
    SafariViewController.isAvailable(function (available) {
      if (available) {
        SafariViewController.show({
          url: url
        })
      } else {
        window.open(url, '_blank', 'location=yes');
      }
    })
  }
})

The result is the ultimate link experience: Open in native app if it's installed, otherwise use in app browser, otherwise use system browser.

I'm going to be using this in my production app, and I think others might desire this behavior too. Can you update the README to mention how deep links aren't followed, and this is the solution? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant