The clear() method removes all the Storage Object item for this domain.
The clear() method belongs to the Storage Object, which can be either a localStorage object or a sessionStorrage object.
Method | |||||
---|---|---|---|---|---|
clear() | 4 | 8 | 3.5 | 4 | 10.5 |
localStorage.clear()
sessionStorage.clear()
No parameters.
DOM Version: | Web Storage API |
---|---|
Return Value: | No return value |
The same example, but using session storage instead of local storage.
Remove all session items:
sessionStorage.clear();
Try it Yourself »
Web Storage Reference: removeItem() Method
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!