This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

removeItem

Summary

Removes the key/value pair with the given key from the list associated with the object, if it exists.

Method of apis/web-storage/Storageapis/web-storage/Storage

Syntax

 object.removeItem(key);

Parameters

key

Data-type
String

The name of the key, or the empty string.

Return Value

No return value

Examples

// Check for support of sessionStorage
if(window.sessionStorage) {

  // Add a key/value pair
  sessionStorage.setItem('someKey', 'value');

  // Remove the item you just added
  sessionStorage.removeItem('someKey');
}

Related specifications

W3C Web Storage Specification
W3C Editor’s Draft

Attributions