Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SessionStorage #81

Open
nmsn opened this issue Jan 19, 2023 · 0 comments
Open

SessionStorage #81

nmsn opened this issue Jan 19, 2023 · 0 comments

Comments

@nmsn
Copy link
Owner

nmsn commented Jan 19, 2023

sessionStorage 属性允许你访问一个,对应当前源的 session Storage 对象。它与 localStorage 相似,不同之处在于 localStorage 里面存储的数据没有过期时间设置,而存储在 sessionStorage 里面的数据在页面会话结束时会被清除。

  1. 页面会话在浏览器打开期间一直保持,并且重新加载或恢复页面仍会保持原来的页面会话。
  2. 在新标签或窗口打开一个页面时会复制顶级浏览会话的上下文作为新会话的上下文, 这点和 session cookies 的运行方式不同。
  3. 打开多个相同的 URL 的 Tabs 页面,会创建各自的 sessionStorage。
  4. 关闭对应浏览器标签或窗口,会清除对应的 sessionStorage。

关键在于复制,并不是共享,修改其中一个,另外的会话中的对应 sessionStorage 并不会改变

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant