cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Polivy <>
Subject RE: [DISCUSS] Android InAppBrowser circular loop with deep links
Date Wed, 09 Mar 2016 17:25:58 GMT
I haven't heard any feedback on this, but I went ahead and opened a PR with an implementation
of option #1 below:

Note, if the current app is not one of the targets, then the current behavior stays the same.
This only impacts Intents where the current app is one of the targets.

I'd certainly appreciate feedback on the implementation and a review of the PR!


-----Original Message-----
From: Dan Polivy [] 
Sent: Monday, March 07, 2016 2:51 PM
To: '' <>
Subject: [DISCUSS] Android InAppBrowser circular loop with deep links

Hi folks,

I've been working on adding deep linking/Universal links to my app, and ran into an issue
with the InAppBrowser on Android that I'd appreciate some feedback on. For those not familiar,
deep linking allows the app to handle standard HTTP/HTTPS urls for a given website within
the app itself.

On Android, you can add an intent-filter to your manifest that says the app handles URLs for<>. The problem is, if your app later wants to
direct the user to<> in the browser (using the
inappbrowser plugin with "_system" as the target), it's very hard to do so. Because the app
itself defines a handler for that URL, it is the default action that gets executed. And thus
you can end up with a circular loop where it tries to launch the app again (and in my case,
crashes - but that may be a separate issue).

I see a couple of ways of addressing this, and would appreciate feedback on what others think
is the best option (or other options I might have overlooked). I'm happy to submit a PR.

1)      When opening an external URL where the current app is one of the intents that can
handle it, instead of the default behavior we create a custom chooser that has all intent
targets EXCEPT the current app. The downside to this approach is that no "default" can be
set for future occurrences, so a chooser will always be shown. (Note, if the URL to be opened
does not have this app as an intent target, then the current behavior will apply.)

2)      I don't know if there's any reliable way to find the default browser on the device,
but if there is, we can explicitly set the component for the Intent so it opens in the browser.
As a fallback, we could use the Android System Browser, or Chrome, depending on OS version.
I'd prefer this if there was a good way to get the default browser, but so far I haven't found

Here's the bug:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message