clear Method (Storage, Storage Constructor)

Switch View :
ScriptFree
clear Method

Removes all key/value pairs from the Web Storage area.

Syntax

object.clear()

Return Value

No return value.

Remarks

Session storage is cleared immediately. Local storage key/value pairs are removed from memory, and disk storage quota is updated.

Example

The following button clears the local storage area for the current domain.


<button onclick="localStorage.clear()">
    Clear Stored Values</button> 

Standards Information

There is no public standard that applies to this method.

Applies To

Storage, Storage Constructor

See Also

removeItem