English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
removeItem()This method deletes the specified key from the given storage object.
If there is no item associated with the given key, this method will not perform any operation.
The removeItem() method belongs to the storage object and can belocalStorageorsessionStorageObject.
localStorage.removeItem(keyName)
sessionStorage.removeItem(keyName)
localStorage.removeItem('url');Test and See‹/›
The numbers in the table specify the first browser version that fully supports the removeItem() method:
Method | |||||
removeItem() | 4 | 3.5 | 11.5 | 4 | 9 |
Parameter | Description |
---|---|
keyName | A string containing the key name to be deleted |
Return Value: | None |
---|---|
DOM Version: | Network Storage API |
Delete the value of the specified session storage item:
sessionStorage.removeItem('time');Test and See‹/›
HTML Tutorial:Web Storage API
Window (Window) Reference:window.localStorage property
Window (Window) Reference:window.sessionStorage property