Posts

Showing posts with the label Storage

What's localStorage About

I've read even too many articles recently talking about storing anything you want in the localStorage ... and I believe this is wrong in so many levels. First of all, localStorage is not a database , 'cause if you consider it a database you should have considered a database document.cookie before ... As Simple As That document.cookie has been there, problematic as it is, since ever.The limit of this technique has always been the 2Mb on average across different browsers. Have you ever asked yourself what the hell is document.cookie doing and how comes it's instantly available? Well, it's about storing some stuff in your hard disk or your browser (SQLite) database, so that every single request will send this file loads of key/values pairs through the HTTP request. The side effect of this technique is that more you pollute cookies in your site to remember stuff, the more the interaction will be slower, specially on mobile, since all these info have to be sent to the se...

W3 HTML5 Storage - What Works, What Does Not

My last sessionStorage is basically ready to implement storage events but apparently I cannot implement them right now. Why not? Doing some test I just discovered a lot of inconsistency for each browser which supports Web Storage in core, so here I am with a little report and some suggestion. The Correct Way To Set or Get Items Every single example I've read so far about Web Storage is not respecting standards defined by the official draft , even if related browsers respect the official API. // bad sessionStorage usage example if(sessionStorage.myKey !== null){ // not implementable with old browsers // it could inherit from a modified Storage prototype // it could be a false positive with native API } else { sessionStorage.myKey = "myValue"; // requires getter/setter, improbable with other browsers // it could overwrite native properties or methods // sessionStorage.key = "value"; will *break* the object }; // W3 standard sugges...