Search code examples
cordovacordova-pluginsinappbrowser

How to properly use InAppBrowser in Cordova 5.x.x?


I'm migrating from an older version of Cordova, and I have an issue, I'm trying to open link in the native browser when a specific button is pressed, my code is the following:

The button is in a string:

"<button class='btn btn-lg btn-primary btn-block' onclick='cordova.InAppBrowser.open(\""+link+"\", \"_system\", \"location=no\");'>Open System Browser</button>";

link is a variable that containes the URL, i.e. "http://www.google.com". Thanks for reading.

that's what I'm doing wrong?


Solution

  • You have to add the plugin first and then use the open() method from window object and use the target as _system

    window.open('http://www.google.com', '_system', 'location=no');