“clean” a cookie...

“clean” a cookie...

  
Hi,
I have a button! That will “clean” a cookie that the browser has (ECT_ClickedFeedback).
When the button is clicked the extended properties come in…

onclick -> “delete_cookie (ECT_ClickedFeedback);”

function delete_cookie ( cookie_name ) {
var cookie_date = new Date ( );
cookie_date.setTime ( cookie_date.getTime() - 1 );
document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}

The help I need is that the expired date continues to be the same!
What am I doing wrong?

Thanks
You could try setting the expiry date to some absolute value in the past, like 1st January 1900:

function delete_cookie ( cookie_name ) {
var cookie_date = new Date ( );
cookie_date.setDate( 1 );
cookie_date.setMonth( 0 );
cookie_date.setYear( 1900 );
document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}



Or, instead of changing the expiry time by a millisecond, which is what I think you're doing there, you could set the expiry date to a day or more in the past. Something like:

function delete_cookie ( cookie_name ) {
var cookie_date = new Date ( );
cookie_date.setDate ( cookie_date.getDate() - 1 );
document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}