If it doesn't, we run another function, populateStorage(), which uses tItem() to set the item values, then runs setStyles(). If it does, we run a function called setStyles() that grabs the data items using localStorage.getItem() and uses those values to update page styles. We first test whether the local storage contains data items using !localStorage.getItem('bgcolor'). Here we access a Storage object by calling localStorage. Storage.clear() When invoked, will empty all keys out of the storage. Storage.removeItem() When passed a key name, will remove that key from the storage. tItem() When passed a key name and value, will add that key to the storage, or update that key's value if it already exists. Chrome DevTools Protocol - version tot - DOMStorage domain. Whether the storage is local storage (not session storage). Storage.getItem() When passed a key name, will return that key's value. Represents a key by which DOM Storage keys its CachedStorageAreas. Methods Storage.key() When passed a number n, this method will return the name of the nth key in the storage. Properties Storage.length Read only Returns an integer representing the number of data items stored in the Storage object.
If you want to manipulate the session storage for a domain, you call ssionStorage method If you want to manipulate the local storage for a domain, you call Window.localStorage. The Storage interface of the Web Storage API provides access to the session storage or local storage for a particular domain, allowing you to for example add, modify or delete stored data items.