Skip to content Skip to sidebar Skip to footer

Delete Cookie When Browser Closed

i need to delete cookie when browser is closed and already put on window.onbeforeunload along with other as following: window.onbeforeunload = function(){ location.replace

Solution 1:

Not specifying Expires value on the cookie will cause the cookie to be removed when the browser session ends i.e. when user closes the browser. Like:

Set-Cookie: made_write_conn=1295214458; Path=/; Domain=.foo.com

The made_write_conn cookie made_write_conn does not have an expiration date, making it a session cookie. It will be deleted after the user closes his/her browser. Try doing:

setCookie('Times',value, '');

Solution 2:

You can not change the page's location when the browser is being closed.

On the server you should be using session end events to clean up the account.

Post a Comment for "Delete Cookie When Browser Closed"