
Browser persistence
Browser persistence is a technique that allows you to store quite large amounts of data in the browser, which, unlike cookies, are not sent to the server with every request.
Everything has already been written before me, but I haven’t found any more or less detailed references on the hub; therefore, I wrote a brief review - how it works and collected links for a more detailed study.
Firefox 2+ implements the HTML5 Web Storage standard . The standard provides for the storage of data in localStorage and sessionStorage objects, which differ in data visibility.
Actually, saving and reading data is very simple - in key-value pairs of these objects (not only in FF but in other browsers that support Web storage): In Firefox there is also globalStorage not described in the specification. Yes, localStorage is only implemented in FF versions 3.5+. The data size limit is 5MB per domain. You can read about them on the Mozilla Developer Center website .
IE - Web Storage is also implemented in the eighth version .
The size of the stored data is up to 10MB.
In versions of IE 5-7 there is a userData behavior interface . Data Limit: 128K per page and 1024K per domain.
Web storage is implemented in only the fourth version.
In other browsers, this is somehow deaf. If in Chrome I have our mention that localStorage support can be enabled in dev versions of the browser, then with respect to Opera I did not find any mention at all.
But everything can be fixed by using a small flash movie in these browsers that uses the sharedObjects interface. That is, we checked web storage and userData. Does not work? We insert flash and use it.
A ready-to-use library written by Ilya Kantor can be found here: browserpersistence.ru .
A more detailed article by Ilya Kantor at http://javascript.ru/unsorted/storage .
John Resig (by jQuery) article on DOM Storage: http://ejohn.org/blog/dom-storage/
And another PersistJS library, but I haven't tried it yet: http://pablotron.org/?cid=1557
Everything has already been written before me, but I haven’t found any more or less detailed references on the hub; therefore, I wrote a brief review - how it works and collected links for a more detailed study.
How it works
Firefox
Firefox 2+ implements the HTML5 Web Storage standard . The standard provides for the storage of data in localStorage and sessionStorage objects, which differ in data visibility.
Actually, saving and reading data is very simple - in key-value pairs of these objects (not only in FF but in other browsers that support Web storage): In Firefox there is also globalStorage not described in the specification. Yes, localStorage is only implemented in FF versions 3.5+. The data size limit is 5MB per domain. You can read about them on the Mozilla Developer Center website .
sessionStorage["name"] = "Вася";
var name = sessionStorage["name"];
Internet explorer
IE - Web Storage is also implemented in the eighth version .
The size of the stored data is up to 10MB.
In versions of IE 5-7 there is a userData behavior interface . Data Limit: 128K per page and 1024K per domain.
Safari
Web storage is implemented in only the fourth version.
Other browsers
In other browsers, this is somehow deaf. If in Chrome I have our mention that localStorage support can be enabled in dev versions of the browser, then with respect to Opera I did not find any mention at all.
But everything can be fixed by using a small flash movie in these browsers that uses the sharedObjects interface. That is, we checked web storage and userData. Does not work? We insert flash and use it.
References
A ready-to-use library written by Ilya Kantor can be found here: browserpersistence.ru .
A more detailed article by Ilya Kantor at http://javascript.ru/unsorted/storage .
John Resig (by jQuery) article on DOM Storage: http://ejohn.org/blog/dom-storage/
And another PersistJS library, but I haven't tried it yet: http://pablotron.org/?cid=1557