I have nothing against adjusting the cookie in my own code, it doesn't need to be a generally available option. E-junkieGuru suggested that as a solution, but in my testing and multiple attempts and approaches at changing the cookie, I couldn't do it. Perhaps it's just a lack of knowledge on how. None of the following approaches seem to work:
function Set_Cookie( name, value, expires, path, domain, secure ) {
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );
// if the expires variable is set, make the correct expires time, the
// current script below will set it for x number of days, to make it
// for hours, delete * 24, for minutes, delete * 60 * 24
if ( expires )
{
//expires = expires * 1000 * 60 * 60 * 24;
expires = expires * 1000 * 60;
}
//alert( 'today ' + today.toGMTString() );// this is for testing purpose only
var expires_date = new Date( today.getTime() + (expires) );
//alert('expires ' + expires_date.toGMTString());// this is for testing purposes only
alert('new value ' + escape(value));
document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + //expires.toGMTString()
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
// This also deletes the cookie at end of session
function del_cookie(name) {
document.cookie = name +
'=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
}
// This deletes the cookie right now
function blank_cookie(name) {
alert(Get_Cookie(name));
Set_Cookie(name,'0','/','.bftix.org');
// or Set_Cookie(name,'0'); neither works
alert(Get_Cookie(name));
}
If you go to the site and select Santaland Diaries, click the 'Start Over' button, you'll see the alerts from a call to blank_cookie.