cordova-plugin-themeablebrowser icon indicating copy to clipboard operation
cordova-plugin-themeablebrowser copied to clipboard

ReferenceError: cordova is not defined

Open judson75 opened this issue 8 years ago • 3 comments

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

judson75 avatar Sep 15 '17 17:09 judson75

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

  1. Have you included cordova.js in your head section?
  1. 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.

ralphcode avatar Sep 15 '17 23:09 ralphcode

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.

judson75 avatar Sep 18 '17 14:09 judson75

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.

ralphcode avatar Sep 26 '17 11:09 ralphcode