开发者

jQuery cookie control

开发者 https://www.devze.com 2023-01-03 16:16 出处:网络
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

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

精彩评论

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