requestFileSystem 在 Windows XP 上抛出 SECURITY_ERR - Chrome
以下代码在具有必要权限的 Chrome 应用程序中使用。它在 Windows XP 以外的任何操作系统中都可以正常工作。
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
window.requestFileSystem(
window.PERSISTENT,
1024*1024,
function(fs) {
//...
},
function(e) {
var msg = '';
switch (e.code) {
case FileError.QUOTA_EXCEEDED_ERR:
msg = 'Quota exceeded.';
break;
case FileError.NOT_FOUND_ERR:
msg = 'Not found.';
break;
case FileError.SECURITY_ERR:
msg = 'Security error.';
break;
case FileError.INVALID_MODIFICATION_ERR:
msg = 'Invalid modification.';
break;
case FileError.INVALID_STATE_ERR:
msg = 'Invalid state.';
break;
default:
msg = 'Unknown error.';
break;
};
alert(msg);
}
);
另外,如果您访问 HTM5Rocks.com 上的文件系统示例,它会在 Windows XP 下抛出相同的错误: http://www.html5rocks.com/en/tutorials/file/filesystem/
我当前的 Google Chrome 版本是“13.0.782.220 m”
The following code is used in a Chrome application with the necesary permissions. It works ok in any operating system other than Windows XP.
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
window.requestFileSystem(
window.PERSISTENT,
1024*1024,
function(fs) {
//...
},
function(e) {
var msg = '';
switch (e.code) {
case FileError.QUOTA_EXCEEDED_ERR:
msg = 'Quota exceeded.';
break;
case FileError.NOT_FOUND_ERR:
msg = 'Not found.';
break;
case FileError.SECURITY_ERR:
msg = 'Security error.';
break;
case FileError.INVALID_MODIFICATION_ERR:
msg = 'Invalid modification.';
break;
case FileError.INVALID_STATE_ERR:
msg = 'Invalid state.';
break;
default:
msg = 'Unknown error.';
break;
};
alert(msg);
}
);
Also, if you visit the filesystem example on HTM5Rocks.com, it throws the same errror under Windows XP: http://www.html5rocks.com/en/tutorials/file/filesystem/
My current Google Chrome version is "13.0.782.220 m"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许您刚刚遇到了这个 webkit 错误 http://code.google .com/p/chromium/issues/detail?id=94314
Maybe you've just faced with this webkit bug http://code.google.com/p/chromium/issues/detail?id=94314
还要检查您是否正在网络服务器上运行该页面?
这对我来说是 SECURITY_ERR:
但这不会:
Also check that you are running the page on a web server?
This throws the SECURITY_ERR for me:
But this doesn't: