jQuery Remember Plugin to Set and Read Cookies and localStorage

File Size: 73.1 KB
Views Total: 1127
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
jQuery Remember Plugin to Set and Read Cookies and localStorage

jQuery Remember Plugin is a fork and enhancement of jQuery Cookie plugin that provides you with a simple way to create, read, and remove cookies and localStorage.

You might also like:

How to use it:

1. Include jQuery library on your web page

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

2. Include jQuery Remember Plugin after jQuery library

<script src="jquery.remember.js"></script>

3. Create localstorage item

$.remember({ name: 'name', value: 'value' })

4. Create session cookie

$.remember({ name: 'name', value: 'value', use: 'cookie' });

5. Create expiring cookie lasting 20 years

$.remember({ name: 'name', value: 'value', expires: 365 * 20 });

6. Create localstore item

$.remember({ name: 'name', value: 'value', fallback: false });

7. Read (will automatically fallback + check the other for named pair, unless specified)

$.remember({ name: 'name' });
$.remember({ name: 'name', use: 'cookie', fallback: false });
$.remember({ name: 'not_found' }) => null

8. Get or Set item

$.remember({ name: 'name', value: 'value', getSet: true }) => will not set if already exists

9. Remove cookie/localstorage:

$.remember({ name: 'name', remove: true });
$.remember({ name: 'name', use: 'localstorage', fallback: false });

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