Goal
I want to link to external websites but retain the ability for users to either go back or close the external page. Adding external links (on iOS) opens the page without any back functionality without any plugins added.
Remediation Steps
I’ve tried a number of different ways of adding Cordova’s InAppBrowser (both using cordova and ionic commands from terminal, both using either the git link or the plugin add org.apache.cordova.inbrowserapp, including edits to the config.xml file for the feature, i.e.
From Terminal
cordova plugin add org.apache.cordova.inbrowserapp
In Config.xml
Asking for Help
Is there a definitive or best practice way to open external links in Ionic?
From what I have understood, ionic works with the device’s browser, whenever you try to open an external link in the app could not return to my app. I occupy appbrowser as plugin and I solve all my problems.
You can see from the docs that you can configure whether to launch the url in system browser or InAppBrowser, and whether you show or hide buttons and location bar.
I just added the plugin using cordova plugin add org.apache.cordova.inbrowserapp
I created a fresh project, added Cordova inappbrowser (which is referenced in the materials I’d been looking at), etc. Everything compiles fine for ios and android. However, links in ios (at least) still load in-app rather than the system browser.
I feel like I’m back on training wheels again. Some threads suggest listening for the event, other say not to, some suggest onclick while other ngclick, some say to add controllers and others say that’s not necessary.
The last one I tried said to simply run the following:
<a class="item" href="#" onclick="window.open('http://www.starwars.com/', '_system', 'location=yes'); return false;">Go Somewhere in System Browser</a>
The forums are a mess with different methods (see original post for a few threads) and I can’t get any of them to work.
Very grateful for best practices for handling multiple external urls in the system browser throughout an app. Am I going about this the wrong way?
I was facing same issue in my Ionic3 application. Then just installed In App Browser Plugin and it then problem solved.
Please check below code after installing plugin and let me know result.