How to Delete Session Cookie?

cookies, jquery

Solution

A session cookie is just a normal cookie without an expiration date. Those are handled by the browser to be valid until the window is closed or program is quit.

But if the cookie is a `httpOnly` cookie (a cookie with the `httpOnly` parameter set), you cannot read, change or delete it from outside of HTTP (meaning it must be changed on the server).

Problem

How to dynamically, via jQuey, delete a session cookie, without manually restarting the browser? I read somewhere that session cookie is retained in browser memory and will be removed when the browser is closed. ``` // sessionFooCookie is session cookie // this code does not delete the cookie while the browser is still on jQuery.cookie('sessionFooCookie', null); ``` More Info: The code snippet above is a javascript code snippet, using jQuery and its jQuery.cookie plugin.

Original source