Storage clear() 方法
描述
clear() 方法將移除此域的所有 Storage 物件項。
clear() 方法屬於 Storage 物件,該物件可以是 localStorage 物件或 sessionStorage 物件。
瀏覽器支援
方法 | |||||
---|---|---|---|---|---|
clear() | 4 | 8 | 3.5 | 4 | 10.5 |
語法
localStorage.clear()
或
sessionStorage.clear()
引數值
無引數。
技術詳情
DOM 版本 | Web Storage API |
---|---|
返回值 | 無返回值 |
更多示例
相關頁面
Web Storage 參考:removeItem() 方法