Storage removeItem() Method
- Previous Page setItem()
- Next Page clear()
- Go Up One Level Storage Object
Definition and Usage
The removeItem() method removes the specified item from the Storage object.
The removeItem() method belongs to the Storage object, which can be localStorage Object, which can also be sessionStorage Object.
Browser Support
Method | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
removeItem() | 4 | 8 | 3.5 | 4 | 10.5 |
Syntax
localStorage.removeItem(keyname)
Or:
sessionStorage.removeItem(keyname)
Parameter Value
Parameter | Description |
---|---|
keyname | Required. A string value that specifies the name of the item to be removed. |
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");
Related Page
Web Storage Reference Manual:getItem() Method
Web Storage Reference Manual:setItem() Method
- Previous Page setItem()
- Next Page clear()
- Go Up One Level Storage Object