- 2014 11/06
链接:https://github.com/carhartl/jquery-cookie
使用方法简介:
创建 session cookie(浏览器关闭后删除):
$.cookie('the_cookie', 'the_value');
创建指定过期时间的cookie,7天后过期:
$.cookie('the_cookie', 'the_value', { expires: 7 });
创建7天后会过期的cookie,cookie对整个网站有效:
$.cookie('the_cookie', 'the_value', { expires: 7, path: '/' });
读取cookie
$.cookie('the_cookie'); // => "the_value"
$.cookie('not_existing'); // => undefined
读取所有cookie:
$.cookie(); // => { "the_cookie": "the_value", "...remaining": "cookies" }
删除cookie:
// Returns true when cookie was found, false when no cookie was found...
$.removeCookie('the_cookie');
// Same path as when the cookie was written...
$.removeCookie('the_cookie', { path: '/' });


