Simple example with window.requestFileSystem() function

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 07:21:05

That's because this functionality is currently only availble prefixed, ie window.webkitRequestFileSystem

You may find this turorial interesting: http://www.html5rocks.com/en/tutorials/file/filesystem/

This code works for me in chrome. I actually used it for phonegap, but I tested it first on chrome on my notebook and a yellow bar appeared on the top of the browser, asking me to allow the web app permanent storage on my local drive.

    navigator.webkitPersistentStorage.requestQuota(1024*1024, 
        function(grantedBytes) {
            window.requestFileSystem(window.PERSISTENT, grantedBytes, onInitFs, errorHandler);
        }, 
        function(errorCode) {
            alert("Storage not granted.");
        }
    );
puneet

open chrome from command line using below command

chrome --allow-file-access-from-files
user3062037

You should change

window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; 

to

window.RequestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; 

(The R should have been capitalized.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!