PersistJS: Cross Browser Client-Side Persistent Storage
PersistJS is a simple to use Javascript to store persistent data on the client Browser. This library supports multiple back-ends which are listed later. The following example will show you how easy it is to store and retrieve data using PersistJS.
To Store Data:
// create a new client-side persistent data store
var store = new Persist.Store('My Data Store');
// pretend data
var data = "pretend this is really long data that won't fit in a cookie";
// save data in store
store.set('saved_data', data);To Retreive Data:
// get data back from store, and prompt user with it
store.get('saved_data', function(ok, val) {
if (ok)
alert('saved data = ' + val);
});PersistJS addresses all of the issues above. It currently supports persistent client-side storage through the following backends:
* flash: Flash 8 persistent storage.
* gears: Google Gears-based persistent storage.
* localstorage: HTML5 draft storage.
* whatwg_db: HTML5 draft database storage.
* globalstorage: HTML5 draft storage (old spec).
* ie: Internet Explorer userdata behaviors.
* cookie: Cookie-based persistent storage.
You can also remove storage engines you don’t want to use in PersistJS by removing that storage engine by code:
// never use cookies for persistent storage
Persist.remove('cookie');Links:
PersistJS Project Home Page
Download PersistJS



