English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Web Storage APIThe Storage object provides access to session or local storage for a specific domain.
For example, it allows adding, modifying, or deleting stored data items.
For example, to manipulate the session storage of a domain, callwindow.sessionStorage.For local storage, then callwindow.localStorage.
The following table lists the properties and methods of the Storage object:
Property/Method | Description |
---|---|
length | Return an integer representing the number of data items stored in the Storage object |
key(n) | Return the name of the nth key in the storage |
getItem(keyname) | Return the value of the specified key name |
setItem(keyname, value) | Add the key to the storage or update the value of the key (if it already exists) |
removeItem(keyname) | Delete the key from the storage |
clear() | Clear all keys from the storage repository |
Property | Description |
---|---|
window.localStorage | Allow keys/Value pairs are stored in web browsers. Store data without an expiration date. |
window.sessionStorage | Allow keys/Value pairs are stored in web browsers. Store data for a session. |