如何在 Firefox 中查看/删除本地存储?
在 Google Chrome 中,有一种简单的方法可以查看本地存储中的内容以及在检查后修改或删除它。
有没有办法在 Firefox 中做同样的事情?
In Google Chrome there is an easy way to see what's in local storage as well as modify or delete it after inspecting it.
Is there a way to do the same in Firefox?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
您可以使用 Firebug(一种有用的 Web 开发扩展)或 Firefox 的开发者控制台一项一项地删除 localStorage 项目。
Firebug 方法
Developer Console 方法
您可以将这些命令输入到控制台:
存储检查器方法
Firefox 现在有一个内置的存储检查器,您可能需要手动启用。请参阅下面拉希尔瓦齐尔的回答。
You can delete localStorage items one by one using Firebug (a useful web development extension) or Firefox's developer console.
Firebug Method
Developer Console Method
You can enter these commands into the console:
Storage Inspector Method
Firefox now has a built in storage inspector, which you may need to manually enable. See rahilwazir's answer below.
从 Firefox 34 开始,您现在可以选择存储检查器,您可以使用它可以从开发人员工具设置启用它
。 默认 Firefox 开发者工具下的
存储
选项2016 年 3 月 27 日更新
Firefox 48.0a1 现在支持 Cookie 编辑。
2016 年 3 月 4 日更新
Firefox 48.0a1 现在支持 localStorage 和 sessionStorage 编辑。
更新于 2016 年 2 月 8 日
Firefox 48(稳定版)及更高版本支持编辑除 IndexedDB 之外的所有存储类型
From Firefox 34 onwards you now have an option for Storage Inspector, which you can enable it from developer tools settings
Once there, you can enable the
Storage
options under Default Firefox Developer toolsUpdated 27-3-16
Firefox 48.0a1 now supports Cookies editing.
Updated 3-4-16
Firefox 48.0a1 now supports localStorage and sessionStorage editing.
Updated 02-08-16
Firefox 48 (stable release) and onward supports editing of all storage types, except IndexedDB
要检查您的 localStorage 项目,您可以在 javascript 控制台(例如 firebug 或在新的 FF 版本中附带的 js 控制台)中输入
console.log(localStorage);
。您可以使用这行代码来删除浏览器本地存储内容。只需在 JavaScript 控制台中执行即可:
To inspect your localStorage items you may type
console.log(localStorage);
in your javascript console (firebug for example or in new FF versions the shipped js console).You can use this line of Code to get rid of the browsers localStorage contents. Just execute it in your javascript console:
由于“localStorage”只是另一个对象,您可以:在“控制台”中创建、查看和编辑它。只需输入“localStorage”作为命令并按 Enter,它将显示一个包含 localStorage 的键值对的字符串(提示:单击该字符串可进行格式化输出,即显示每行中的每个键值对)。
As 'localStorage' is just another object, you can: create, view, and edit it in the 'Console'. Simply enter 'localStorage' as a command and press enter, it'll display a string containing the key-value pairs of localStorage (Tip: Click on that string for formatted output, i.e. to display each key-value pair in each line).
现在有一个很棒的 Firebug 插件,可以在 chrome 中克隆这个不错的功能。查看:
https://addons.mozilla.org/en-US/firefox/addon/ firestorage-plus/
由 Nick Belhomme 开发并定期更新
There is now a great plugin for Firebug that clones this nice feature in chrome. Check out:
https://addons.mozilla.org/en-US/firefox/addon/firestorage-plus/
It's developed by Nick Belhomme and updated regularly
我无法直接在 Firefox (v27) 控制台中使用
localStorage
。我收到错误:有效的是:
I could not use
localStorage
directly in the Firefox (v27) console. I got the error:What worked was:
试试这个,它对我有用:
Try this, it works for me:
Firefox 插件 StoragErazor 支持手动和自动清除本地存储。即使在 FF 设置中清除“Cookie 和站点数据”不会清除本地存储,它也会清除本地存储。
上面的开发者控制台方法一次只能运行一个选项卡,AFAICT。
The Firefox addon StoragErazor supports both manual and automatic clearing of local storage. It will clear local storage even when clearing "Cookies and Site Data" in FF Settings doesn't.
The developer console method above works only one tab at a time, AFAICT.