Link to home
Start Free TrialLog in
Avatar of manoj91
manoj91

asked on

function delete_cookie()

I would like to have a cooke removed by expiring the cookie.

code.js contains this method:

function delete_cookie()
      {
             var expireDate = new Date ( );              // current date & time
              expireDate.setTime ( expireDate.getTime() - 1 );
              document.cookie date = expireDate.toGMTString();
      }


it is called when the button is clicked in details.htm.  this is the html part of the button:

<input type="button" value="Clear Cookie" onclick="delete_cookie()">

Not sure about the last line in the function.

tks
ASKER CERTIFIED SOLUTION
Avatar of devic
devic
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry, the correct day is Thu, but it delete the cookie anyway. You can write any day of the week, for example: Mon,
But to be correct it should be:

     document.cookie=cookieName+"=;expires=Thu, 01 Jan 1970";


Thanks.