zoukankan      html  css  js  c++  java
  • Web technology for developersSee Web APIsStorage

    Storage

    The Storage interface of the Web Storage API provides access to a particular domain's session or local storage. It allows, for example, the addition, modification, or deletion of stored data items.

    To manipulate, for instance, the session storage for a domain, a call to Window.sessionStorage is made; whereas for local storage the call is made to Window.localStorage.

    Window.sessionStorage

    The sessionStorage property accesses a session Storage object for the current origin. sessionStorage is similar to localStorage; the difference is that while data in localStorage doesn't expire, data in sessionStorage is cleared when the page session ends.

    • A page session lasts as long as the browser is open, and survives over page reloads and restores.
    • Opening a page in a new tab or window creates a new session with the value of the top-level browsing context, which differs from how session cookies work.
    • Opening multiple tabs/windows with the same URL creates sessionStorage for each tab/window.
    • Closing a tab/window ends the session and clears objects in sessionStorage.

    Window.localStorage

    The read-only localStorage property allows you to access a Storage object for the Document's origin; the stored data is saved across browser sessions. localStorage is similar to sessionStorage, except that while data stored in localStorage has no expiration time, data stored in sessionStorage gets cleared when the page session ends — that is, when the page is closed. (Data in a localStorage object created in a "private browsing" or "incognito" session is cleared when the last "private" tab is closed.)

    Data stored in either localStorage or sessionStorage is specific to the protocol of the page. In particular, data stored by a script on a site accessed with HTTP (e.g., http://example.com) is put in a different localStorage object from the same site accessed with HTTPS (e.g.,  https://example.com).

    The keys and the values are always in the UTF-16 DOMString format, which uses two bytes per character.  (As with objects, integer keys are automatically converted to strings.)

  • 相关阅读:
    Docker--简介&&安装
    Mycat
    Mysql--主从复制
    Nginx--平滑升级
    Nginx--rewrite
    Nginx--缓存
    Mysql--SQL语句
    Nginx--虚拟主机
    Nginx--反向代理&&负载均衡
    Nginx--用户认证&&访问控制&&限速&&状态访问
  • 原文地址:https://www.cnblogs.com/chucklu/p/13381570.html
Copyright © 2011-2022 走看看