Software Archive
Read-only legacy content

InAppBrowser

Brandt__Lars
New Contributor I
268 Views

I tried using the emulator and App Preview but I can't get InAppBrowser to work.

Here's what I did:
- START NEW PROJECT
- Choose HTML5 + Cordova
- Include InAppBrowser plugin
- Add this code to myEventHandler in app.js:

try {
  var ref =  cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
}
catch (e) {       
  alert(e.message);
 }

I get a message telling me that "open" is not a property of "undefined" (meaning that InAppBrowser is undefined)

 What am I missing?

0 Kudos
1 Reply
Rakshith_K_Intel
Employee
268 Views

use window.open instead of cordova.InAppBrowser.open

cordova.InAppBrowser.open in newer InAppBrowser API implementation in latest plugin which is not implemented in emulator yet, window.open works and is backwards compatible. More details here: https://github.com/apache/cordova-plugin-inappbrowser

 

0 Kudos
Reply