Handling Window Session Storage With jQuery - session.js

Handling Window Session Storage With jQuery - session.js
File Size: 3.32 KB
Views Total: 327
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

session.js is a super tiny sessionStorage manipulation plugin used to set, get, clear, and remove data saved in browser session storage.

See Also:

How to use it:

1. Load the main script jquery.session.js after loading the latest jQuery library.

<script src="/path/to/cdn/jquery.min.js"></script>
<script src="/path/to/jquery.session.js"></script>

2. Save data to sessionStorage.

// $.session.set('key', 'value');
$.session.set('website', 'jqueryscript');

3. Get saved data from sessionStorage.

// $.session.get('key');
$.session.get('website');
=> 'jqueryscript'

4. The plugin also supports method chaining as follows:

$.session.set('website', 'jqueryscript').get('website');
=> 'jqueryscript'

5. Remove saved data from sessionStorage.

// $.session.remove('key');
$.session.remove('website');

6. Clear all saved data from sessionStorage.

$.session.clear();

This awesome jQuery plugin is developed by AlexChittock. For more Advanced Usages, please check the demo page or visit the official website.