intern cookie 纠结之二
1 $.cookie("username","") //设置cookie为空,长度为0 2 $.cookie("username",null) //设置cookie为"null",但是cookie还是存在,长度为4 3 $.cookie("username","",{expires:date}) //在指定时间销毁后,cookie值为undefined 4 username=="" //判断cookie值为不为空 5 username==null //判断cookie存在不存在 6 username==undefined //判断cookie存在不存在,同上
注意:$.cookie("username",null) 只能设置cookie为字符串null,不能真正删除元素。
综上所述,并未找到真正的设置cookie为null的方法,设置cookie为""是清空缓存的唯一解决办法。
posted on 2015-08-14 11:37 xiaoshan_coding 阅读(102) 评论(0) 收藏 举报
浙公网安备 33010602011771号