Storage removeItem() Method

Example

Remove 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 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");

Try it yourself

Related Page

Web Storage Reference Manual:getItem() Method

Web Storage Reference Manual:setItem() Method