HOT.CHO
HOT.CHO

Reputation: 769

Can javascript delete a cookie set by http header?

I try to delete cookie set by http header but doesn't work. What's the different between http-set cookie and javascript-set cookie ?

Upvotes: 7

Views: 17399

Answers (1)

penguat
penguat

Reputation: 1357

Yes, javascript can delete a cookie set by HTTP headers unless it is specifically a HTTPOnly cookie.

The cookie must also be from the same domain as the javascript.

See also http://www.quirksmode.org/js/cookies.html and Clearing all cookies with JavaScript

Upvotes: 11

Related Questions