initialxy / cordova-plugin-themeablebrowser

Fork of org.apache.cordova.inappbrowser in an attempt to make it a bit more themeable and configurable to add some custom actions.
Apache License 2.0
295 stars 221 forks source link

ReferenceError: cordova is not defined #150

Open judson75 opened 7 years ago

judson75 commented 7 years ago

It is not working in my app. In my browser I get :"ReferenceError: cordova is not defined" at this line: cordova.ThemeableBrowser.open

ralphcode commented 7 years ago

Few immediate suggestions without more info on your environment / set up;

  1. Have you included cordova.js in your head section?

  2. Are you running after the device ready event? I.e.

function onDeviceReady () {
     alert("onDeviceReady()!");
     //now cordova.ThemeableBrowser.open..
}

document.addEventListener('deviceready', onDeviceReady, false);
  1. You mention 'In my browser' - this plugin will not work in your browser. You'll need to compile with Cordova / PGB

Otherwise please let us know what you are using, some code snippets, cordova config, etc.

judson75 commented 7 years ago

I do have the cordova.js called (in the footer). But my call is on a button click event, so not sure how to initiate on devive.ready, and open during trigger event. On my phone, it does nothing when I click, but I do not know how to debug (new to phonegap).

Thanks for the response.

ralphcode commented 7 years ago

I'd recommend you start from something like the hello world app if you are new to PhoneGap; here

This outlines when the deviceready() event is called and therefore you should be able to use plugins (if you've included it in your config).

How are you running your app? If you use this plugin, you'll need to use something like Cordova CLI or PhoneGapBuild to pull it all together.