English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
clear()Method to clear all keys stored in the given storage object.
The clear() method belongs to the storage object and can belocalStorageObject orsessionStorrageObject.
localStorage.clear();
sessionStorage.clear();
localStorage.clear();Test and See‹/›
The numbers in the table specify the first browser version that fully supports the clear() method:
Method | |||||
clear() | 4 | 3.5 | 11.5 | 4 | 9 |
Return Value: | None |
---|---|
DOM Version: | Network Storage API |
Delete all session storage items:
sessionStorage.clear();Test and See‹/›
HTML Tutorial:Web Storage API
Reference: Window (Window)window.localStorage property
Reference: Window (Window)window.sessionStorage property