English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JS Storage Object

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.

Properties and Methods of the Storage Object

The following table lists the properties and methods of the Storage object:

Property/MethodDescription
lengthReturn 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

Network Storage API

PropertyDescription
window.localStorageAllow keys/Value pairs are stored in web browsers. Store data without an expiration date.
window.sessionStorageAllow keys/Value pairs are stored in web browsers. Store data for a session.