admin管理员组文章数量:1201569
I am trying on Firefox,IE 9,Chrome and Opera the code below ,but the onInitFs(fs) function doesn't get called.if I add '()' to onInitFs in the window.requestFileSystem(window.PERSISTENT, 1024*1024, onInitFs, errorHandler) that function get called but fs is null ? Does anybody know how to solve this problem?I try on windows 7.I'll appreciate very much your help.
<!DOCTYPE HTML>
`<html>
<head>
<script>
function errorHandler(e){
alert("errorrrr");
}
function onInitFs(fs){
alert("onInitFs");
}
function readClick(){
if (window.webkitRequestFileSystem) {
window.webkitRequestFileSystem(window.PERSISTENT, 1024*1024,onInitFs,errorHandler);
}
else {
window.requestFileSystem(window.PERSISTENT, 1024*1024, onInitFs, errorHandler);
}
alert("read finishsssss");
}
</script>
</head>
<body>
<input type="button" value="Read dir" onclick="readClick()">
<ul id="filelist"></ul>
</body>
</html>
I am trying on Firefox,IE 9,Chrome and Opera the code below ,but the onInitFs(fs) function doesn't get called.if I add '()' to onInitFs in the window.requestFileSystem(window.PERSISTENT, 1024*1024, onInitFs, errorHandler) that function get called but fs is null ? Does anybody know how to solve this problem?I try on windows 7.I'll appreciate very much your help.
<!DOCTYPE HTML>
`<html>
<head>
<script>
function errorHandler(e){
alert("errorrrr");
}
function onInitFs(fs){
alert("onInitFs");
}
function readClick(){
if (window.webkitRequestFileSystem) {
window.webkitRequestFileSystem(window.PERSISTENT, 1024*1024,onInitFs,errorHandler);
}
else {
window.requestFileSystem(window.PERSISTENT, 1024*1024, onInitFs, errorHandler);
}
alert("read finishsssss");
}
</script>
</head>
<body>
<input type="button" value="Read dir" onclick="readClick()">
<ul id="filelist"></ul>
</body>
</html>
Share
Improve this question
edited Mar 29, 2012 at 11:11
Rob W
349k87 gold badges807 silver badges682 bronze badges
asked Jul 23, 2011 at 20:19
Tony2Tony2
1111 gold badge1 silver badge4 bronze badges
1
- Related: stackoverflow.com/questions/19802032/… – Pacerier Commented Jan 31, 2017 at 14:47
2 Answers
Reset to default 14Only chrome supports requestFileSystem
as the webkitRequestFileSystem
version.
None of the other browsers (FF6, IE9, Op11) support this
Disregarding the security issue that you cannot "browse" local files with a website, your question should be answered:
When requesting a PERSISTENT filesystem you have to request a quota in first. Try that instead:
window.storageInfo.requestQuota(PERSISTENT, 1024*1024,
function(grantedBytes) {
window.requestFileSystem(window.PERSISTENT, grantedBytes, onInitFs, errorHandler);
},
errorHandler
);
本文标签: javascriptwindowrequestFileSystem not workingStack Overflow
版权声明:本文标题:javascript - window.requestFileSystem not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738566650a2100279.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论