Written by James McDonald

February 18, 2009

Internet Explorer 7 doesn’t seem to like the max-age= way of defining cookie aging.

It doesn’t like this (i.e. no persistent cookie is created):

document.cookie = cookieName + "=" + cookieValue + 
			"; max-age=" + (60*60*24*365) ;
                       // 1 year in seconds

But does like this:

var nextyear = new Date();
nextyear.setFullYear(nextyear.getFullYear() + 1);
document.cookie = cookieName + "=" + cookieValue + 
			"; expires=" + nextyear.toGMTString();

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…