HTML5 Local Cache Localstorage and Sessionstorage methods of Operation Collection

Source: Internet
Author: User
Tags sessionstorage

Description

The Web Storage consists of two mechanisms as follows:

    • sessionStorageMaintains a separate storage area for each given source (given origin), which is available during a page session (that is, as long as the browser is open, including page reload and recovery).
    • localStorageThe same functionality, but the data still exists after the browser shuts down and then reopened.

Both of these mechanisms are Window.sessionStorage used by and Window.localStorage attributes (more specifically, objects are implemented in supported browsers and Window objects are WindowLocalStorage WindowSessionStorage hung localStorage under them and sessionStorage properties)--calling any of these objects creates an Storage object, by object, you can set, get, and remove data items. For each source (origin) sessionStorage and localStorage the use of different Storage objects--run and control independently.

For example, a call in a document localStorage would return an object, and the Storage call would sessionStorage return a different Storage object. These objects can be manipulated in the same way, but the operation is independent.

Reference:

Https://developer.mozilla.org/zh-CN/docs/Web/API/Window/localStorage

Https://developer.mozilla.org/zh-CN/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API

Https://developer.mozilla.org/zh-CN/docs/Web/API/Window/sessionStorage

Https://www.cnblogs.com/st-leslie/p/5617130.html

HTML5 Local Cache Localstorage and Sessionstorage methods of Operation Collection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.