View Single Post
Old 09-12-2012, 11:34 AM   PM User | #1
swiltch
New Coder

 
Join Date: Nov 2010
Posts: 51
Thanks: 8
Thanked 0 Times in 0 Posts
swiltch is an unknown quantity at this point
Changing a cookies expiry date

Hello,

I have the following code -

Code:
  jQuery(document).ready(function(){
    if (document.cookie.indexOf('visited=true') == -1) {
        var fifteenDays = 1000*60*60*24*365;
        var expires = new Date((new Date()).valueOf() + fifteenDays);
        document.cookie = "visited=true;expires=" + expires.toUTCString();
        }
});
I'm using it for a pop-up on a page on my website, giving users a reminder to register, and setting it to expire in 365 days.

However, within the pop-up I need some text saying "Remind Me Later" that will instead expire the cookie in 24 hours, so they get the pop-up again the next day.

Is this possible? Any help appreciated.
swiltch is offline   Reply With Quote