Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to clear cookies?

Status
Not open for further replies.

redss

Programmer
Oct 20, 2002
195
I am setting cookies with the http header "Set-Cookie"

what is the easiest way to clear ALL the cookies? (like when user logs out) Do I have to clear each cookie individually, or can I clear all from the site with one header?

thanks!
 
What exactly are you wanting to do? Clear all cookies as the user exits your site? If you don't set an expiration date for the cookie, that will happen automatically (when the user closes the browser).

While there may be a way to clear cookies with a header, the only way I currently know how is with JavaScript. All you have to do is access a cookie and set its expiration date to the current time.

If this doesn't help, you might post a little more info.
 
You just reset the cookie with a time in the past or set the value equal to '' or nothing.


haunter@battlestrata.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top