jQuery.storage

jStorage provides an convenient API for storing values. Use the same API for storing your data in localStorage, sessionStorage, cookies (bonus: cookies as localStorage/sessionStorage fallback!) and jQuery.data.


Keywords
storage, localstorage, cookie, $.data, webstorage, sessionstorage, api
License
GPL-3.0
Install
bower install jQuery.storage

Documentation

jStorage

jStorage provides an convenient API for storing values. Use the same API for storing your data in localStorage, sessionStorage, cookies (bonus: cookies as localStorage/sessionStorage fallback!) and jQuery.data.

Examples

Create & Update:

    jQuery.storage.setItem('key','value','localStorage|sessionStorage|cookie|data');

Delete

    jQuery.storage.removeItem('key','localStorage|sessionStorage|cookie|data');

Read

    jQuery.storage.getItem('key','localStorage|sessionStorage|cookie|data');

Length (returns the number of key/value pairs for this specific type)

    jQuery.storage.length('localStorage|sessionStorage|cookie|data');

Convenient: If you skip the last "type" parameter, jStorage automatically uses the last type you used to store your data with.

Requires

License

Dual licensed under the MIT and GPL licenses.

Copyright (c) 2011Martin Krause (jquery.public.mkrause.info)