小编Ton*_*ny2的帖子

window.requestFileSystem无效

我正在尝试Firefox,IE 9,Chrome和Opera下面的代码,但是onInitFs(fs)函数没有被调用.如果我在window.requestFileSystem中添加'()'到onInitFs(window.PERSISTENT,1024*1024,onInitFs,errorHandler)该函数被调用但fs为null?有谁知道如何解决这个问题?我试试Windows 7.我非常感谢你的帮助.

<!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>
Run Code Online (Sandbox Code Playgroud)

javascript html5 html5-filesystem

10
推荐指数
2
解决办法
3万
查看次数

标签 统计

html5 ×1

html5-filesystem ×1

javascript ×1