未捕获的Ref​​erenceError:科尔多瓦没有定义 [英] Uncaught ReferenceError: cordova is not defined

查看:257
本文介绍了未捕获的Ref​​erenceError:科尔多瓦没有定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的HelloPlugin.js文件。

This is my HelloPlugin.js file.

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

我收到以下异常...

I am getting following exception...

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

感谢你在前进。

推荐答案

普莱斯请确保您有<脚本... 标记的 cordova.js 的前<脚本... 标记的 HelloPlugin.js 的在你的HTML文件

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

它应该有两个在&LT; HEAD&GT; 这样的标签:

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

<script src="cordova.js"></script>
<script src="HelloPlugin.js"></script>

这篇关于未捕获的Ref​​erenceError:科尔多瓦没有定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆