Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
272 views
in Technique[技术] by (71.8m points)

javascript - HTML5本地存储与会话存储(HTML5 Local storage vs. Session storage)

除了非持久性和仅限于当前窗口的范围之外,对本地存储的会话存储有任何好处(性能,数据访问等)吗?

  ask by jpkeisala translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

localStorage and sessionStorage both extend Storage .

(localStoragesessionStorage都扩展了存储 。)

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.

(关闭后,将删除存储的数据。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...