[ 
https://issues.apache.org/jira/browse/CB-10795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15187441#comment-15187441
 ] 

ASF GitHub Bot commented on CB-10795:
-------------------------------------

GitHub user dpolivy opened a pull request:

    https://github.com/apache/cordova-plugin-inappbrowser/pull/154

    [CB-10795] Exclude current app from external intent list

    On Android, if the app defines an intent-filter for a given URL, and
    then tries to use inappbrowser to launch that URL via the _system
    target, the default handler for that intent is the app itself.
    
    That behavior can lead to circular loops, and ultimately is not what the
    developer wants -- the link should be launched in a browser.
    
    Because there is no easy way to find the "default" system browser on a
    device, this solution will do two things:
    1) Check if the app is one of the targets for this intent
    2) If so, create a custom chooser with all other targets, excluding the
    current app.
    
    If the app is not a target, then the current (existing) behavior is
    preserved.
    
    The only real "downside" to this approach is that a default handler can no 
longer be set for these URLs within the app, and a chooser will be shown each 
time the user taps a link that opens in a new browser.
    
    Fixes https://issues.apache.org/jira/browse/CB-10795

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dpolivy/cordova-plugin-inappbrowser CB10795

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-inappbrowser/pull/154.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #154
    
----
commit 00df83cbe4166c575173b1a4df3430ab41fa57c5
Author: Dan Polivy <[email protected]>
Date:   2016-03-09T17:19:11Z

    [CB-10795] Exclude current app from external intent list
    
    On Android, if the app defines an intent-filter for a given URL, and
    then tries to use inappbrowser to launch that URL via the _system
    target, the default handler for that intent is the app itself.
    
    That behavior can lead to circular loops, and ultimately is not what the
    developer wants -- the link should be launched in a browser.
    
    Because there is no easy way to find the "default" system browser on a
    device, this solution will do two things:
    1) Check if the app is one of the targets for this intent
    2) If so, create a custom chooser with all other targets, excluding the
    current app.
    
    If the app is not a target, then the current (existing) behavior is
    preserved.
    
    Fixes https://issues.apache.org/jira/browse/CB-10795

----


> [InAppBrowser] Circular loop if app had an intent-filter defined for the URL 
> being opened
> -----------------------------------------------------------------------------------------
>
>                 Key: CB-10795
>                 URL: https://issues.apache.org/jira/browse/CB-10795
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin InAppBrowser
>            Reporter: Dan Polivy
>            Priority: Minor
>              Labels: Android, triaged
>
> Consider the following scenario:
> 1. App "X" has an intent-filter defined that says it can open URLs for 
> "www.example.com". (e.g., using 
> https://github.com/EddyVerbruggen/Custom-URL-scheme plugin)
> 2. App "X" wants to launch a specific URL on www.example.com in the system 
> browser.
> 3. App "X" uses InAppBrowser plugin and calls {{window.open}} with 
> {{_system}} as the target.
> Actual:
> Since the app itself has an intent-filter defined for "www.example.com", 
> InAppBrowser will just re-launch the app with the intent. In some cases, if a 
> default handler is not chosen, one will get a chooser, however the app will 
> still be listed as the default option.
> Expected:
> The app should be able to launch the URL in the system browser to avoid a 
> circular redirect.
> There is some discussion of this issue on stackoverflow:
> http://stackoverflow.com/questions/18682833/how-to-exclude-a-specific-application-from-action-view-intent
> http://stackoverflow.com/questions/29529027/open-url-in-browser-even-though-my-app-registered-an-intent-filter-for-it
> I think it might be reasonable for InAppBrowser, in {{openExternal}}, to 
> explicitly remove the current app from the list.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to