localStorage and sessionStorage both extend Storage .
(localStorage和sessionStorage都扩展了存储 。)
There is no difference between them except for the intended "non-persistence" of sessionStorage
.(除了sessionStorage
的预期“非持久性”之外,它们之间没有区别。)
That is, the data stored in localStorage
persists until explicitly deleted.
(也就是说,存储在localStorage
的数据会一直存在,直到被明确删除。)
Changes made are saved and available for all current and future visits to the site.(所做的更改将保存,并可用于该网站的所有当前和未来访问。)
For sessionStorage
, changes are only available per tab.
(对于sessionStorage
,更改仅适用于每个选项卡。)
Changes made are saved and available for the current page in that tab until it is closed.(所做的更改将保存并可用于该选项卡中的当前页面,直到关闭为止。)
Once it is closed, the stored data is deleted.(关闭后,将删除存储的数据。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…