Cordova.js文件无效

时间:2013-09-15 23:47:14

标签: jquery mobile cordova

我在jqm + phonegap应用程序中使用以下Cordova文件。

http://clubbedinapp.com/jsa/cordova.js

当应用程序打开时,会出现如下警告:

enter image description here

此外,页面只是冻结,不允许我做任何事情。

如何解决此错误?

index.html的一些代码:

<link rel="stylesheet" href="css/jquery.mobile-1.3.1.min.css"/>
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/jquery.mobile-1.3.1.min.js"></script>

<!-- The following must be AFTER jquery core and BEFORE jquery mobile js -->
<script type="text/javascript">
    $(document).on("mobileinit", function() {
    $.mobile.touchOverflowEnabled = true; // required
    $.mobile.defaultPageTransition = 'none'; // optional - for better performance on Android
    $.mobile.defaultDialogTransition = 'none';
    $.mobile.loadingMessageTextVisible = true; // optional - added to show text message
    $.mobile.buttonMarkup.hoverDelay = 0; // optional added to remove sluggishness - jqm default 200
    $.mobile.allowCrossDomainPages = true;
    $.support.cors = true;
    });

// Wait for PhoneGap to load
document.addEventListener("deviceready", onDeviceReady, false);

// PhoneGap is ready
function onDeviceReady() {
// Do cool things here...
}

function getImage() {
// Retrieve image file location from specified source
navigator.camera.getPicture(uploadPhoto, function(message) {
alert('Get Picture Failed. Please Try Again.');
},{
quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
}
);

}

function uploadPhoto(imageURI) {
var options = new FileUploadOptions();
options.fileKey="file";
options.fileName=curClub+imageURI.substr(imageURI.lastIndexOf('/')+1);
options.mimeType="image/jpeg";

var params = new Object();
params.value1 = "test";
params.value2 = "param";
params.clubID = curClub ;
options.params = params;
options.chunkedMode = false;

var ft = new FileTransfer();
ft.upload(imageURI, "url", win, fail, options);
}

function win(r) {
console.log("Code = " + r.responseCode);
console.log("Response = " + r.response);
console.log("Sent = " + r.bytesSent);;
}

function fail(error) {
alert("An error has occurred: Code = " = error.code);
}
</script>

<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<link rel="stylesheet" href="css/latest.css"/>
<script src="js/latest.js"></script>
<script type="text/javascript" charset="utf-8" src="js/jquery.validate.min.js"></script>
<link rel="stylesheet" href="css/jqm-datebox.min.css" />
<link rel="stylesheet" href="css/jquery.mobile.simpledialog.min.css" />
<link rel="stylesheet" href="jquery.mobile.flatui.css" />
<script type="text/javascript" charset="utf-8" src="js/jqm-datebox.core.min.js"></script>
<script type="text/javascript" charset="utf-8" src="js/jquery.mobile.simpledialog2.min.js"></script>

1 个答案:

答案 0 :(得分:1)

您必须在使用其API之前包含Cordova库

根据评论,如果您使用PhoneGap Build来创建可安装文件,则还必须不包含cordova.js文件。

相关问题