Storage removeItem() method

Example

Delete the specified local storage item:

localStorage.removeItem("mytime");

Try it yourself

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, specifying the name of the item to be deleted.

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.

Delete the specified session storage item:

sessionStorage.removeItem("test1");

Try it yourself

Relevant page

Web Storage-Referenzhandbuch:getItem()-Methode

Web Storage-Referenzhandbuch:setItem()-Methode