jquery.cookie Operation in:

jquery.cookie.js Is based onjquery Plugins

Create a sessioncookie:


notes: When not specifiedcookie Time time, Createdcookie Valid until the user browser is closed by default, So it's called conversationcookie.

Create a persistentcookie:


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

Create a persistentcookie:


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

Create a persistentcookie:

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

notes:domain: Establishcookie Domain name of the webpage;secure: The default isfalse, If sotrue,cookie The transmission protocol of should behttps;raw: Default isfalse, Automatic encoding and decoding during reading and writing( UseencodeURIComponent Code, UsedecodeURIComponent Decode), Turn this feature off, Please set it totrue.


$.cookie(‘cookieName’);   // Return if presentcookieValue, Otherwise returnnull.



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