【Util】之——cookie

拿走即用

 

使用前引入文件:https://files.cnblogs.com/ccto/util-cookie.js

使用方法:

//设置cookie
CookieUtil.set("name", "xiaoMo");
CookieUtil.set("util", "cookie");

//读取cookie
CookieUtil.get("name");
CookieUtil.get("util");

//删除cookie
CookieUtil.unset("name");
CookieUtil.unset("util");

//设置cookie 包括路径、域、失效日期
CookieUtil.set("name", "xiaoMo", '/path1/path2/', "www.abc.com", new Date('January 12,2015'));

//删除上面设置的cookie
CookieUtil.unset("name", '/path1/path2/', "www.abc.com");

//设置安全cookie
CookieUtil.set("name", "xiaoMo", null, null, null, true);

 

posted on 2013-06-18 14:24  _xiaoMo_  阅读(376)  评论(0编辑  收藏  举报

导航