如何通過javascript動態地刪除會話cookie,而無需手動重啓瀏覽器?如何刪除會話Cookie?
我在某處讀到會話cookie保留在瀏覽器內存中,當瀏覽器關閉時會被刪除。
// sessionFooCookie is session cookie
// this code does not delete the cookie while the browser is still on
jQuery.cookie('sessionFooCookie', null);
謝謝。
更多信息:上面的代碼段是 JavaScript代碼段,使用jQuery 及其jQuery.cookie插件。
我必須說,我是用頭靠在顯示器跳動約一個小時的問題_「爲什麼我無法從JavaScript的刪除會話cookie?」 _,直到我有沒有發現簡短的答案:它是`httpOnly` ...謝謝,非常有用。 – BlitZ 2016-07-08 03:54:04
供參考:在_Gumbo的最後一句話中,他實際上是指_server side_。 – ThomasDC 2017-10-23 07:49:41