Can javascript delete a cookie set by http header?
15,612
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
Related videos on Youtube
Comments
-
HOT.CHO almost 2 years
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 ?
-
CodeCaster about 11 yearsThe answer is in here: How to Delete Session Cookie?. If a cookie is set with
HttpOnly
, you cannot access it from JS. -
penguat about 11 yearsAre they HTTPOnly cookies? Can your JavaScript read them?
-