5

is there any method (using JavaScript) how to store session until browser is closed? I wanted to use session cookie - when expires is not set the cookie is supposed to expire when browser is closed. But for any practical purpose this is not usable because Firefox with Show my windows and tabs from last time option does not clear session cookies even after browser is closed.

I also cannot use onunload or onbeforeunload because I need to remember the data until the browser is closed even when users reloads or goes to some other page and then comes back.

4

1 回答 1

4

您可能对sessionStorage,localStorage鲜为人知的表弟感兴趣。它应该完全满足您的需要——在会话中存储变量并在会话结束时清除它们。

于 2012-07-16T14:25:53.693 回答