javascript cookie

<script>
var cookie_options = {
	path: '/', // cookie is valid across the entire domain
	expires: 365, // expires in 365 days
	//domain: 'example.com', // by default domain of page where the cookie was created
	secure: false // if true, the cookie transmission requires a secure protocol (https)
};

Cookies.set( 'cookie_name', 'cookie_value', cookie_options );

Cookies.get( 'cookie_name' ); // => 'value'
Cookies.get( 'cookie_does_not_exist' ); // => undefined

Cookies.get(); // => { name: 'value' } - get all visible cookies

Cookies.remove('name', { path: '' });
</script>

Leave a Reply

Your email address will not be published. Required fields are marked *