Skip to main content
Inspiring
May 1, 2006
Answered

Cookie Question

What am I doing wrong??
Variable1 is not defined, but variable2 is defined.
Page has also been reloaded several times to make sure the cookie existed prior to the page loading.
When checking my cookies folder, both are listed in the same txt file.
This topic is closed to new replies. Start a new post to keep the conversation going.
romeogqCorrect answer
Inspiring
May 2, 2006
Nevermind. I figured it out. Someone should have picked up on this relatively quickly. I thought the problem was on the cold fusion side, but it was on the javascript side. I didn't set the expirer property correctly. 'Never' doesn't work. Had to use the following...

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

1 reply

romeogqAuthorCorrect answer
Inspiring
May 2, 2006
Nevermind. I figured it out. Someone should have picked up on this relatively quickly. I thought the problem was on the cold fusion side, but it was on the javascript side. I didn't set the expirer property correctly. 'Never' doesn't work. Had to use the following...

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

Translate