# Opening External Links in Ionic

**URL:** <https://forum.ionicframework.com/t/opening-external-links-in-ionic/12265>\
**Category:** uncategorized\
**Created:** [November 6, 2014, 9:01am UTC](https://forum.ionicframework.com/t/opening-external-links-in-ionic/12265 "2014-11-06T09:01:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpeters911](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/dpeters911/32/67279_2.png) [@dpeters911](https://forum.ionicframework.com/u/dpeters911)\
**Post date:** [November 6, 2014, 9:01am UTC](https://forum.ionicframework.com/t/opening-external-links-in-ionic/12265/1 "2014-11-06T09:01:25Z")

</div>

**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?

Sources Already Consulted

> **[Opening external URLs / file downloads into system browser instead of app](http://forum.ionicframework.com/t/opening-external-urls-file-downloads-into-system-browser-instead-of-app/7521)**
>
> Hi all, after some googling and research on these forum I'm still stuck on a seemingly simple problem. I need to render a couple buttons inside a view, one of which will link to a file download (zip or pdf), and the other to an external website...

  

> **[How to: Opening links in content in system browser instead of Cordova browser...](http://forum.ionicframework.com/t/how-to-opening-links-in-content-in-system-browser-instead-of-cordova-browser-wrapper/2427)**
>
> Hey there, I'd like to share an implementation with you, partly as documentation for others and maybe to see if it can be improved in some way. There are some cases in which you might have content that links to an external website. The problem is...

  

> **[External Links (facebook/twitter) to load OUTSIDE of app?](http://forum.ionicframework.com/t/external-links-facebook-twitter-to-load-outside-of-app/977)**
>
> In my app, I of course have a link to facebook and twitter. However what happens is that these links are opened within my app, and not loaded externally. This is fine for the mobile website version, but natively as an app this is not desirable. How...

---

<div class="post-metadata">

**Author:** ![sioesi](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@sioesi](https://forum.ionicframework.com/u/sioesi)\
**Post date:** [November 6, 2014, 2:41pm UTC](https://forum.ionicframework.com/t/opening-external-links-in-ionic/12265/2 "2014-11-06T14:41:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![edd](https://avatars.discourse-cdn.com/v4/letter/e/8c91f0/32.png) [@edd](https://forum.ionicframework.com/u/edd)\
**Post date:** [November 7, 2014, 12:43pm UTC](https://forum.ionicframework.com/t/opening-external-links-in-ionic/12265/3 "2014-11-07T12:43:48Z")

</div>

Hi @dpeters911 - I’m using the InApp browser plugin and it’s working fine.

[http://plugins.cordova.io/#/package/org.apache.cordova.inappbrowser](http://plugins.cordova.io/#/package/org.apache.cordova.inappbrowser)

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`

---

<div class="post-metadata">

**Author:** ![dpeters911](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/dpeters911/32/67279_2.png) [@dpeters911](https://forum.ionicframework.com/u/dpeters911)\
**Post date:** [November 12, 2014, 7:07am UTC](https://forum.ionicframework.com/t/opening-external-links-in-ionic/12265/4 "2014-11-12T07:07:02Z")

</div>

Does anyone have a clear, contemporary example?

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?

Thanks,  
Embarrassed in Seattle 😊

---

<div class="post-metadata">

**Author:** ![dpeters911](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/dpeters911/32/67279_2.png) [@dpeters911](https://forum.ionicframework.com/u/dpeters911)\
**Post date:** [November 12, 2014, 8:24am UTC](https://forum.ionicframework.com/t/opening-external-links-in-ionic/12265/5 "2014-11-12T08:24:17Z")

</div>

Woohoo!

So, I got a nasty build error for ios when adding inappbrowser _after_ ios was added as platform. However, I found a new guide.

It runs! It’s alive! For science!

Here’s my process:

1. create a new ionic app

2. enter app folder

3. cordova plugin add org.apache.cordova.inappbrowser

4. ionic platform add ios

5. Add this code to any html file in www, per [http://www.iperform.nl/en/blog/post/cordova-open-external-link](http://www.iperform.nl/en/blog/post/cordova-open-external-link)

6. ionic run ios

---

<div class="post-metadata">

**Author:** ![rajeshbhardwaj](https://avatars.discourse-cdn.com/v4/letter/r/dfb087/32.png) [@rajeshbhardwaj](https://forum.ionicframework.com/u/rajeshbhardwaj)\
**Post date:** [August 20, 2016, 5:32am UTC](https://forum.ionicframework.com/t/opening-external-links-in-ionic/12265/7 "2016-08-20T05:32:48Z")

</div>

Hi I want to open a pdf link in app browse.

Example : [http://www.orimi.com/pdf-test.pdf](http://www.orimi.com/pdf-test.pdf)

I tried all the possible option in window.open like \_system, \_blank, \_self but they all are showing blank screen.

Any help. I would be very thankful.

---

<div class="post-metadata">

**Author:** ![chris93](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@chris93](https://forum.ionicframework.com/u/chris93)\
**Post date:** [June 5, 2018, 11:40am UTC](https://forum.ionicframework.com/t/opening-external-links-in-ionic/12265/8 "2018-06-05T11:40:41Z")

</div>

so you got the solution to open pdf files inside the InAppbrowser/

---

<div class="post-metadata">

**Author:** ![niravparsana94](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/niravparsana94/32/137813_2.png) [@niravparsana94](https://forum.ionicframework.com/u/niravparsana94)\
**Post date:** [February 3, 2020, 12:33pm UTC](https://forum.ionicframework.com/t/opening-external-links-in-ionic/12265/9 "2020-02-03T12:33:13Z")

</div>

I was facing same issue in my Ionic3 application. Then just installed [In App Browser Plugin](https://ionicframework.com/docs/v3/native/in-app-browser/) and it then problem solved.  
Please check below code after installing plugin and let me know result.

```auto
window.open('http://www.orimi.com/pdf-test.pdf', "_system");

```

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:01pm UTC](https://forum.ionicframework.com/t/opening-external-links-in-ionic/12265/10 "2021-07-19T21:01:46Z")

</div>

Closed on July 19, 2021, 9:01pm UTC


