ionic 2 InAppBrowser url not opening

3.2k views Asked by At

I am using Ionic 2 and trying to open an external link with cordova InAppBrowser.

launch(url) {
  this.platform.ready().then(() => {
    InAppBrowser.open(url, "_system", "location=yes");
    console.log("link viewed");
  });
}

However, this does not open a link when I am testing the app on my phone. Furthermore, it returns this in the console Your current usage of the InAppBrowser plugin is depreciated as of [email protected]. Please check the Ionic Native docs for the latest usage details.

When i change it to this cordova.InAppBrowser.open(url, "_system", "location=yes"); it returns with a syntax error saying cannot find cordova

In the browser window.open(url, "_system", "location=yes"); works fine.

Anyone know the updated way to get the InAppBrowser to open?

1

There are 1 answers

2
SGhaleb On BEST ANSWER

After few hours and looking deep into the documents I found out the reason.

launch(url) { 
   this.platform.ready().then(() => {
     new InAppBrowser(url, "_system", "location=yes");
     console.log("link viewed");
   });
}