javascript - How to use navigator instead of window.webkitStorageInfo HTML5 File-system API? -


so there similar post found here html-5-filesystem-access-type-error. however, i'm not satisfied conclusion because not feel answered question - solution given deprecated code solution. know how use navigator instead of window chrome console informing do?

i have been using following , works, chrome console keeps informing me not because deprecated.

working deprecated code

window.webkitstorageinfo.requestquota(persistent, 1024*1024*280, function(grantedbytes) {     window.webkitrequestfilesystem(persistent, grantedbytes, oninitfs, errorhandler);  }, function(e) {     console.log('error', e);  }); 

note: oninitfs , errorhandler both functions defined elsewhere, work.

console log - message in console follows:

'window.webkitstorageinfo' deprecated. please use 'navigator.webkittemporarystorage' or 'navigator.webkitpersistentstorage' instead.  

so best practice stop using deprecated method. unfortunately, when replace window navigator crashes (see below). how 1 use navigator instead of window access file system?

below 2 examples current api.

it uses navigator.webkitpersistentstorage.requestquota instead of deprecated window.webkitstorageinfo.queryusageandquota:

query quota

navigator.webkittemporarystorage.queryusageandquota (      function(usedbytes, grantedbytes) {           console.log('we using ', usedbytes, ' of ', grantedbytes, 'bytes');     },      function(e) { console.log('error', e);  } ); 

request quota

var requestedbytes = 1024*1024*280;   navigator.webkitpersistentstorage.requestquota (     requestedbytes, function(grantedbytes) {           console.log('we granted ', grantedbytes, 'bytes');      }, function(e) { console.log('error', e); } ); 

you have choose either temporary (webkittemporarystorage) or persistent (webkitpersistentstorage) storage query.

the current chrome implementation tracks specific spec version, describes things bit more: http://www.w3.org/tr/2012/wd-quota-api-20120703/

chromestore.js provides easier api data.


to answer original question, new code this:

request quota , initialize filesystem

var requestedbytes = 1024*1024*280;   navigator.webkitpersistentstorage.requestquota (     requestedbytes, function(grantedbytes) {           window.webkitrequestfilesystem(persistent, grantedbytes, oninitfs, errorhandler);       }, function(e) { console.log('error', e); } ); 

Comments

  1. Javascript - How To Use Navigator Instead Of Window.Webkitstorageinfo
    Html5 File-System Api? - >>>>> Download Now

    >>>>> Download Full

    Javascript - How To Use Navigator Instead Of Window.Webkitstorageinfo
    Html5 File-System Api? - >>>>> Download LINK

    >>>>> Download Now

    Javascript - How To Use Navigator Instead Of Window.Webkitstorageinfo
    Html5 File-System Api? - >>>>> Download Full

    >>>>> Download LINK 3e

    ReplyDelete

Post a Comment

Popular posts from this blog

c# - must be a non-abstract type with a public parameterless constructor in redis -

c# - ReportViewer control - axd url -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -