requestFileSystem throws SECURITY_ERR on Windows XP - Chrome
T开发者_运维技巧he 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"
Maybe you've just faced with this webkit bug http://code.google.com/p/chromium/issues/detail?id=94314
Also check that you are running the page on a web server?
This throws the SECURITY_ERR for me:
file:///Sites/cordova-files/platforms/browser/www/index.html
But this doesn't:
http://localhost:8888/cordova-files/www/
精彩评论