IMPORTANT
This plugin is no longer maintained.
A new one, without dependencies with jQuery, is available : https://github.com/julien-maurel/js-storage
APIs are same, but are accessibles with global variable "Storages" instead "$".
Thanks!
jQuery Storage API is a plugin that simplifies access to storages (HTML5), cookies, and namespace storage functionality and provides compatiblity for old browsers with cookies!
Functionalities:
- To store object easily, encode/decode it with JSON automatically
- Ability to define namespace and use it as a specific storage
- Magic getter and setter to have access at an infinite object level with one call
- Add js-cookie (https://github.com/js-cookie/js-cookie) and manage your cookies with this API
Storages
Local storage
$.localStorage
Session storage
$.sessionStorage
Cookie storage (only if js-cookie added)
$.cookieStorage
Namespace storage
ns=$.initNamespaceStorage('ns_name');
ns.localStorage // Namespace in localStorage
ns.sessionStorage // Namespace in sessionStorage
ns.cookieStorage // Namespace in cookieStorage (only if js-cookie added)
Public methods on storage
Public methods are usable on all storage objects (