sessionStorage到期 [英] Expiry of sessionStorage
问题描述
我正在构建一个表单,我必须将数据存储在html5的 sessionStorage
我不知道 sessionStorage $ c的位置$ c>到期。任何人都可以告诉我有关
sessionStorage的过期时间
I am building a form in which i have to store the data in html5's sessionStorage
i don't know where the sessionStorage
expires. Can anyone tell me about the expiration time of the sessionStorage
推荐答案
它与您的浏览器会话一起生死,并且不会在标签之间共享。它不会自动失效。因此,如果您从未关闭浏览器,它永远不会过期。
It lives and dies with your browser session and is not shared between tabs. It doesn't expire automatically. So if you never close your browser it never expires.
因此,当标签/窗口关闭时,数据会丢失。
So when the tab/window is closed the data is lost.
每个 sessionstorage 区域允许5mb的存储空间(在某些浏览器中为10mb)。其中 cookies 仅允许4kb(或某些浏览器中的更多)。但是Cookie有一个设定的到期日期。
Each sessionstorage area is allowed 5mb of storage (in some browsers 10mb). Where as cookies only allow 4kb (or more in some browsers). Cookies however has a set expiration date.
Christophe 写道在评论中, localstorage 永不过期。它也在标签之间共享,与sessionstorage(5mb)的大小相同。
As Christophe wrote in the comments, localstorage never expires. It's also shared across tabs and is the same size as sessionstorage (5mb).
这篇关于sessionStorage到期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!