我正在尝试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)