本文介绍了如何在午夜使用Jquery终止Cookie?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我这样做了:
$.cookie("ultOS", (i), {expires:1});但是它只会在第二天过期.
But it will only expire next day.
如何在午夜使cookie失效?
How can I expire a cookie at midnight?
可以代替这项工作吗?
var date = new Date(); var midnight = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59); $.cookie("ultOS", (i), {expires: midnight});推荐答案
我认为这可行:
var currentDate = new Date(); expirationDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()+1, 0, 0, 0); $.cookie("ultOS", "5", {expires: expirationDate});更多推荐
如何在午夜使用Jquery终止Cookie?
发布评论