SGhaleb
SGhaleb

Reputation: 1005

ionic 2 InAppBrowser url not opening

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?

Upvotes: 3

Views: 3244

Answers (1)

SGhaleb
SGhaleb

Reputation: 1005

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");
   });
}

Upvotes: 2

Related Questions