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"

有帮助吗?

解决方案

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/
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top