Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 文件系统API不适用于Chrome v27&;v29_Javascript_Html_Google Chrome_Cordova_Fileapi - Fatal编程技术网

Javascript 文件系统API不适用于Chrome v27&;v29

Javascript 文件系统API不适用于Chrome v27&;v29,javascript,html,google-chrome,cordova,fileapi,Javascript,Html,Google Chrome,Cordova,Fileapi,我正在尝试设置一个文件存储,以便以后在Phonegap中使用,但目前正在Chrome中调试。按照上所述的方式,我只能向用户请求配额,但请求文件系统时的回调不会执行。见: window.webkitStorageInfo.requestQuota(PERSISTENT, 1024*1024*1024, function(grantedBytes) { requestFS(grantedBytes); }, onError); function requestFS(grantedBytes

我正在尝试设置一个文件存储,以便以后在Phonegap中使用,但目前正在Chrome中调试。按照上所述的方式,我只能向用户请求配额,但请求文件系统时的回调不会执行。见:

window.webkitStorageInfo.requestQuota(PERSISTENT, 1024*1024*1024, function(grantedBytes) {
    requestFS(grantedBytes);
}, onError);

function requestFS(grantedBytes) {
    window.webkitRequestFileSystem(window.PERSISTENT, grantedBytes, function(fs) {
        // ... does not get called ###################################
    }, onError);
}
现在Chrome警告我webkitStorageInfo已经被弃用,并且从今天开始有了一个新的标准。我尝试使用navigator.webkitPersistentStorage,但没有成功

是否可能文件系统API当前不工作或已被弃用,或者我的上述代码可能有问题

以下函数也不执行任何操作,没有可见的错误:

navigator.webkitPersistentStorage.queryUsageAndQuota(function(usage, quota) {
    console.log(arguments);

    navigator.webkitPersistentStorage.requestQuota(1024 * 1024, function(grantedQuota) {
        console.log(arguments);

        window.webkitRequestFileSystem(window.PERSISTENT, 1024 * 1024, function(fs) {
            console.log(arguments);
        });
    });
});
更新:
Eric Bidelman正在工作,所以我的代码中一定有错误,尽管我看不出Filer init方法和我正在做的有什么区别。

我正在运行Chorme 27,下面的代码似乎工作正常,显示了指示的日志消息

function onError () { console.log ('Error : ', arguments); }

navigator.webkitPersistentStorage.requestQuota (1024*1024*1024, function(grantedBytes) {
  console.log ('requestQuota: ', arguments);
  requestFS(grantedBytes);
}, onError);

function requestFS(grantedBytes) {
  window.webkitRequestFileSystem(window.PERSISTENT, grantedBytes, function(fs) {
    console.log ('fs: ', arguments); // I see this on Chrome 27 in Ubuntu
  }, onError);
}

基本上,我将原始代码中的
window.webkitStorageInfo.requestQuota
更改为
navigator.webkitspersistentstorage.requestQuota
,并删除了
PERSISTENT
参数,但这正是我所做的,不是吗?我想故障更复杂,因为我将其插入到现有的广泛应用程序中。无论如何,感谢您的试用,Filer.js让我走上了正确的道路。我在chrome 27.0.1453.116上运行,但此代码不起作用我收到一个文件错误。无效\u修改\u错误