Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught ReferenceError: cordova is not defined

This is my HelloPlugin.js file.

var HelloPlugin = { 
  callNativeFunction: function(success,fail,resultType) { 
    return cordova.exec(success, fail, "HelloPlugin", "nativeAction", [resultType]); 
  } 
};

I am getting the following exception:

: Uncaught ReferenceError: cordova is not defined at file:///android_asset/www/HelloPlugin.js:3

Thank you in advance.

like image 316
ssg Avatar asked Nov 01 '12 11:11

ssg


1 Answers

Pleas make sure you have <script ... tag for cordova.js before <script ... tag for HelloPlugin.js in your HTML file.

It should have both in the <head> tag like this:

<script src="cordova.js"></script>
<script src="HelloPlugin.js"></script>
like image 200
Jordan Avatar answered Sep 20 '22 00:09

Jordan