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 ?
Asked
Active
Viewed 1.7k times
7
-
3The answer is in here: [How to Delete Session Cookie?](http://stackoverflow.com/questions/1085756/how-to-delete-session-cookie). If a cookie is set with `HttpOnly`, you cannot access it from JS. – CodeCaster Mar 14 '13 at 11:24
-
1Are they HTTPOnly cookies? Can your JavaScript read them? – penguat Mar 14 '13 at 11:30
1 Answers
11
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