jquery.cookie Operations in :

jquery.cookie.js Is based on jquery Plug in for

Create a session cookie:


notes : When not specified cookie Time hour , Created by cookie Valid until the user browser is closed by default , So it's called conversation cookie.

Create a persistent cookie:


notes : When time is specified , So it's called lasting cookie, And valid for days .

Create a persistent cookie:


notes : If a valid path is not set , By default , Only in cookie Set the current page to read this cookie,cookie Is used to set the ability to read cookie Top level directory for .

Create a persistent cookie:

$.cookie(‘cookieName’,'cookieValue’,{expires:7,path:’/',domain: ‘chuhoo.com’,secure: false,raw:false});

notes :domain: establish cookie Domain name of the webpage ;secure: The default is false, If is true,cookie The transmission protocol of should be https;raw: Default is false, Automatic encoding and decoding during reading and writing ( use encodeURIComponent code , use decodeURIComponent decode ), Turn this feature off , Please set to true.

obtain cookie:

$.cookie(‘cookieName’);   // Return if present cookieValue, Otherwise return null.

delete cookie:


notes : If you want to delete a cookie, as follows :$.cookie(‘cookieName’,null,{path:’/'});