是否可以从phonegap将文件保存在缓存目录中?
谢谢
紫皮
你可以做这样的事情。Juste 用 cordova.file.cacheDirectory 替换 cordova.file.dataDirectory (我认为这是正确的名称)
window.resolveLocalFileSystemURL(
cordova.file.dataDirectory,
function gotDir(dir) {
console.log("Data directory located");
dir.getFile(sessionID + ".html", {create:true},
function(file) {
console.log("got the file", file);
file.createWriter(this.gotFileWriter,
function fail() {
console.log("Unable to create the writer");
});
});
}
function fail()
console.log("Unable to locate the cache");
});