Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome webkitStorageInfo.requestQuota

I'm trying to utilize local FS in Chrome. The first thing I do - request filesystem quota. The code below worked only once, making Chrome to show confirmation. But after that this code does nothing: no alert is displayed. What is wrong with this code?

window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;     
window.webkitStorageInfo.requestQuota( 
            window.PERSISTENT,
            fsize,
            function( bytes ) {
                alert( "Quota is available: " + bytes );
            },
            function( e ) {
                alert( "Error allocating quota: " + e );
            }

);
like image 337
Igor Semenov Avatar asked Dec 07 '25 21:12

Igor Semenov


2 Answers

Once the user has granted access to fsize quota, the browser won't reprompt them. Your success callback will be called without the info bar. The only way to see it again (for testing), is to request a larger fsize.

You could also try 'Clear browsing data' in settings to see if that resets things.

like image 148
ebidel Avatar answered Dec 10 '25 09:12

ebidel


From http://www.html5rocks.com/en/tutorials/file/filesystem/:

"Once the user has granted permission, there's no need to call requestQuota() in the future (unless you wish to increase your app's quota). Subsequent calls for equal or lesser quota are a noop."

NB: This implies there's no way for an app to release quota that it no longer needs.

like image 26
Pr0methean Avatar answered Dec 10 '25 10:12

Pr0methean



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!