Deleting a cookie in Javascript not working

Posted by DisgruntledGoat on Stack Overflow See other posts from Stack Overflow or by DisgruntledGoat
Published on 2010-04-06T10:34:07Z Indexed on 2010/04/06 10:43 UTC
Read the original article Hit count: 158

Filed under:
|

I have a site where authentication is done externally (which I can't access), so I'm creating a cookie on login in order to display a welcome message to the user. Creating the cookie works fine, I write to document.cookie when the login form submits.

But deleting the cookie doesn't work. Here's my code (logout.php does the external authentication stuff):

<a href="http://external.com/logout.php" style="float:right"
  onclick="document.cookie='BRLOG=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/; domain=.example.com;'">Logout</a>

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about cookies