clear
Summary
Causes the list associated with the object to be emptied of all key/value pairs, if there are any.
Method of apis/web-storage/Storageapis/web-storage/Storage
Syntax
object.clear();
Return Value
No return value
Examples
The following button clears the local storage area for the current domain.
<button onclick="localStorage.clear()">
Clear Stored Values</button>
Notes
sessionStorage is cleared immediately. localStorage key/value pairs are removed from memory, and disk storage quota is updated.
Related specifications
- W3C Web Storage Specification
- W3C Editor’s Draft
Attributions
Microsoft Developer Network: Windows Internet Explorer API reference Article