I want to download image file with this javascript code:
var fileTransfer = new FileTransfer();
var uri = encodeURI("some_url");
var filePath = 'some_path';
//download a photo!
fileTransfer.download(
uri,
filePath,
successDownload,
failDownload
);
function successDownload(entry) {
alert("download complete: " + entry.fullPath);
}
function failDownload(error) {
alert("An error has occurred: Code = " + error.code);
alert("upload error source " + error.source);
alert("upload error target " + error.target);
}
But I have error "FileTransfer is not defined".
Where do I have to add this code:
document.addEventListener("deviceready", onDeviceReady, true);
function onDeviceReady() {
alert ('123');
}
?
Also I wanted to show alert when Device Ready event. I did following startScreen - Device Ready event - javascript with alert only. But alert was not showed, that means, that event was not called. I test on iPhone iOS 6,7. I have created new project and added following to get event startScreen - Device Ready event - javascript with alert only. But no result. It seems to me, that event is not catched for some reason. Load event works...