- 43
- 0
调用FileSystemAPI在本地沙盒中创建文件,代码如下:
readerFile:function(file,callBack){
fileSystemObj.fs.root.getFile(file, {create: true}, function(fileEntry) {
console.log(3);
fileEntry.file(function(file) {
console.log(4);
var reader = new FileReader();
reader.onloadend = function() {
typeof callBack == 'function' && callBack.call(fileEntry,this.result);
};
reader.readAsText(file);
}, fileSystemObj.errorHandler);
}, fileSystemObj.errorHandler);
},
initialize : function(filename) {
window.requestFileSystem(TEMPORARY, this.size, function (fs) {
fileSystemObj.fs = fs;
fileSystemObj.readerFile(filename,function(text){
console.log(text);
});
})
}
};
if(window.requestFileSystem) {
navigator.webkitTemporaryStorage.queryUsageAndQuota(function (usage, quota) {
if (!quota) {
console.log(1);
navigator.webkitTemporaryStorage.requestQuota(fileSystemObj.size, function () {
fileSystemObj.initialize();
}, fileSystemObj.errorHandler);
}else{
console.log(2)
fileSystemObj.initialize();
}
});
}else{
alert("请使用chrome浏览器浏览!");
}
}
控制台下报错:
2
sandbox_fileSystem.js:23 SecurityError
DOMException: It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources.
请问各位码友如何解决?
0
打赏
收藏
点击回答
- 共 0 条
- 全部回答
更多回答
网站公告
- 扫一扫访问手机版
回答动态

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器更新之后。服务器里面有部分玩家要重新创建角色是怎么回事啊?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题函数计算不同地域的是不能用内网吧?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题ARMS可以创建多个应用嘛?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题在ARMS如何申请加入公测呀?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题前端小程序接入这个arms具体是如何接入监控的,这个init方法在哪里进行添加?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器刚到期,是不是就不能再导出存档了呢?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器的游戏版本不兼容 尝试更新怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器服务器升级以后 就链接不上了,怎么办?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器转移以后服务器进不去了,怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器修改参数后游戏进入不了,是什么情况?预计能赚取 0积分收益
- 回到顶部
- 回到顶部
