Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

How to allow user to open link in external browser from App #51

Closed
anilsaxena opened this issue Mar 14, 2016 · 7 comments
Closed

How to allow user to open link in external browser from App #51

anilsaxena opened this issue Mar 14, 2016 · 7 comments

Comments

@anilsaxena
Copy link

I want user to give ability to open links which are opened by default in App to open in browser. By when I call windows.open(link_url, "_system") it goes in loop on Android, it works on IOS though.

@nikDemyankov
Copy link
Member

Not sure, that this can be done. The problem is that by default Android will open all your UL links in the app, not a browser. Because it's a default behaviour for him and controlled by OS, not by plugin.

You can do a kind of the hack by defining one url in config.xml , but from the JS side opening some other, which leads to the same page. For example:

  1. Define in config.xml:

    <universal-links>
      <host name="example.com" scheme="https">
        <path url="/path/*.html" event="ul_event" />
      </host>
    </universal-links>
  2. Launch app by clicking on https://example.com/path/index.html

  3. To launch same page in browser - call from JS:

    window.open('https://example.com/path/index.html#external', '_system');

@anilsaxena
Copy link
Author

Thanks for the interesting idea, I will try it.

@nikDemyankov
Copy link
Member

It's kind of dirty, but hope it will work :)

@anilsaxena
Copy link
Author

I realized most of my url are like /pages/page_id so not able to use pattern like *.index.html

@nikDemyankov
Copy link
Member

Then I'm afraid this can't be done. As I said before - this is controlled by Android.

The other workaround can be writing native plugin, that accepts the link to open, and it will launch selector, with which app to open this link, so the user could choose the browser.

Or force-open in the browser; but for that you would need explicitly launch browser app.

@alaa-alshamy
Copy link

@anilsaxena @nikDemyankov any updates here ? is it still can't be done in android ?

@nordnet-deprecation-bot
Copy link
Contributor

👋 Hi! Thank you for your interest in this repo.

😢 We are not using nordnet/cordova-universal-links-plugin anymore, and we lack the manpower and the experience needed to maintain it. We are aware of the inconveniece that this may cause you. Feel free to use it as is, or create your own fork.

🔒 This will now be closed & locked.

ℹ️ Please see #160 for more information.

@nordnet nordnet locked and limited conversation to collaborators Sep 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants