我正在使用jquerymobile/phonegap/cordova(2.0)开发一个移动应用程序。我尝试从流(xml)中下载一些文件并将它们存储在本地。这种行为只出现在我用于调试的chrome浏览器中 (使用ripple进行模拟)。
如何启动chrome?以下是步骤:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-web-security --allow-file-access-from-files --allow-file-access
我正在Mac上进行开发,我的plist文件也有一个*访问权限,并且我在我的config.xml中添加了。
我尝试使用以下代码下载一些图片:
在模拟器上工作正常,但在chrome浏览器中出现以下错误:
如何启动chrome?以下是步骤:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-web-security --allow-file-access-from-files --allow-file-access
我正在Mac上进行开发,我的plist文件也有一个*访问权限,并且我在我的config.xml中添加了。
我尝试使用以下代码下载一些图片:
function downloadImage(url,filename,use){
if(use==="thumb") {
filename = filename + ".png";
download(url, filename);
}return filename; }
function download(url, filename) {
//writeLog(window.appRootDir.fullPath);
ft = new FileTransfer();
ft.download(
url,
window.appRootDir.fullPath + "/" + filename,
{},
{});
}
在模拟器上工作正常,但在chrome浏览器中出现以下错误:
TypeError
ripple.js:477
TypeError: Cannot call method 'download' of undefined
at n.exports.exec (chrome-extension://geelfhphabnejjhdalkjhgipohgpdnoc/ripple.js:477:26724)
at FileTransfer.download (http://localhost/~binderf/www/a4/cordova-2.2.0.js:2753:5)
at download (http://localhost/~binderf/www/a4/js/index.js:194:5)
at downloadImage (http://localhost/~binderf/www/a4/js/index.js:182:9)
at Element.<anonymous> (http://localhost/~binderf/www/a4/js/index.js:153:51)
at Function.p.extend.each (http://localhost/~binderf/www/a4/js/jquery-1.8.2.min.js:2:14477)
at p.fn.p.each (http://localhost/~binderf/www/a4/js/jquery-1.8.2.min.js:2:11151)
at Element.<anonymous> (http://localhost/~binderf/www/a4/js/index.js:145:57)
at Function.p.extend.each (http://localhost/~binderf/www/a4/js/jquery-1.8.2.min.js:2:14477)
at p.fn.p.each (http://localhost/~binderf/www/a4/js/jquery-1.8.2.min.js:2:11151) ripple.js:477
FileTransfer
FileTransfer ripple.js:483
download ripple.js:483
missing exec:FileTransfer.download
一个对话框弹出,显示以下信息:
FileTransfer.download
我们好像缺少一些东西 :(
但比较酷的是,你可以填写文本区域,将 JSON 对象传递给你想要执行的回调函数。
我看到它是未定义的,但我无法确定我的问题究竟是什么。如果有人有猜测或类似的问题,请提供任何建议。