Chrome文件系统Api

时间:2016-04-18 12:31:17

标签: asp.net html5 google-chrome-app

我正在尝试使用chrome File System Api创建一个文件,我正在使用以下代码:

function onInitFileSystem(filesystem) {
filesystem.root.getFile('sample.txt', { create: true, exclusive: true },
function (fileEntry) {
// Do something with new file.
}, errorHandler);
}
window.webkitRequestFileSystem(window.Permanent, 1024 * 1024, onInitFileSystem,
errorHandler);

运行此代码后,我收到错误消息: "确定某些文件对于Web应用程序内的访问不安全,或者对文件资源进行了太多调用。" 名:"的SecurityError"

有没有人对这个问题有所了解。

1 个答案:

答案 0 :(得分:0)

当您尝试从提及here的文件运行应用时,这是一个SECURITY_ERR。出于安全原因,这是不允许的。但是,可以使用--allow-file-access-from-files标志临时绕过此测试目的。更新了doc就在这里。