Storage removeItem() Method
Example
Remove the the specified local storage item:
localStorage.removeItem("mytime");
Try it Yourself »
Description
The removeItem() method removes the specified Storage Object item.
The removeItem() method belongs to the Storage Object, which can be either a localStorage object or a sessionStorage object.
Browser Support
Method | |||||
---|---|---|---|---|---|
removeItem() | 4 | 8 | 3.5 | 4 | 10.5 |
Syntax
localStorage.removeItem(keyname)
Or:
sessionStorage.removeItem(keyname)
Parameter Values
Parameter | Description |
---|---|
keyname | Required. A String specifying the name of the item you want to remove |
Technical Details
DOM Version: | Web Storage API |
---|---|
Return Value: | No return value |
More Examples
Example
The same example, but using session storage instead of local storage.
Remove the specified session storage item:
sessionStorage.removeItem("test1");
Try it Yourself »
Related Pages
Web Storage Reference: getItem() Method
Web Storage Reference: setItem() Method