开发者

jQuery cookie control

How to create cookie, which will work on all pages over choosen site?

Using cookie plugin.

Code must add cookie "movie_check" with value "no", which can be used over all pages on site "www.site.c开发者_开发技巧om" (were script is implemented). Expires after 365 days.

Tryed this (doesnt work):

$.cookie("movie_check", "no", {expires: 365, domain: 'www.site.com'});

Thanks.


Try:

 var date = new Date();
 date.setTime(date.getTime() + (3 * 24 * 60 * 60 * 1000));
$.cookie('movie_check', 'no', { path: '/', expires: date });

Your code sets an expiration date in the past.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜