HTML 5文件系统访问类型错误 [英] HTML 5 filesystem access Type Error

查看:291
本文介绍了HTML 5文件系统访问类型错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个webapp,我正在尝试使用文件系统API访问目录。我需要根据规范在访问目录之前向用户请求配额。我应该这样做:

I'm working on a webapp and I'm trying to access directories using the filesystem API. I need to request a quota from the user before accessing the directories according to specification. I should do something like this:

...
navigator.webkitPersistentStorage.requestQuota(PERSISTENT, 1024*1024, 
function(gB){
   window.requestFileSystem(PERSISTENT, gB, onInitFs, errorHandler);
}, function(e){
   console.log('Error', e);
})
...

每当我这样做时, a ** TypeError:输入错误** 消息。请问我做错了什么?提前致谢。

NB:onInitFs和errorHandler已被定义我只是没有在这里包含代码。

Everytime I do this I get a **TypeError: Type error** message. Please what am I doing wrong? Thanks in advance.
NB: onInitFs and errorHandler have been defined I just didn't include the code here.

推荐答案

我遇到了相同的问题,并且有人发布了解决方案,可以在文件系统-api-not-working-in-chrome-v27-v29

I was having the same issues and someone posted the solution, found at filesystem-api-not-working-in-chrome-v27-v29

navigator.webkitPersistentStorage.requestQuota(1024*1024, 
  function(gB){
  window.requestFileSystem(PERSISTENT, gB, onInitFs, errorHandler);
}, function(e){
  console.log('Error', e);
})

您必须从中删除​​ PERSISTENT navigator.webkitPersistentStorage.requestQuota(...)

You have to remove the PERSISTENT from navigator.webkitPersistentStorage.requestQuota(...)

这篇关于HTML 5文件系统访问类型错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆