答案 0 :(得分:1)
浏览器永远不会重置您的本地存储空间。它必须隐藏数据或者代码中必须有一些脚本正在执行此操作。
与localStorage.clear();
一样
尝试关闭并打开开发人员工具选项卡(f12 / ctrl + shift + i),当我刷新页面时,我的浏览器会隐藏localstorage,但当我关闭并重新打开开发人员工具选项卡时,我能够再次看到本地存储数据。
答案 1 :(得分:0)
I don't think your local storage is removed , it is just invisible.. just try to print your data stored in local storage.
console.log(localStorage.getItem("your key"));
and you will get result.
it is a bug , if you want to check then just try to clear the storage and keep the Application tag open in developer option, you will see it will be there and once you reload it will disappear but data will be there..