如何在 Firefox 中查看/删除本地存储?

发布于 2024-11-08 21:17:01 字数 90 浏览 0 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

残花月 2024-11-15 21:17:01

您可以使用 Firebug(一种有用的 Web 开发扩展)或 Firefox 的开发者控制台一项一项地删除 localStorage 项目。

Firebug 方法

  1. 打开 Firebug(单击右下角的小错误图标)
  2. 转到 DOM 选项卡
  3. 向下滚动到并展开 localStorage
  4. 右键单击​​要删除的项目,然后按删除 Property

Developer Console 方法

您可以将这些命令输入到控制台:

localStorage; // click arrow to view object's properties
localStorage.removeItem("foo"); 
localStorage.clear(); // remove all of localStorage's properties

存储检查器方法

Firefox 现在有一个内置的存储检查器,您可能需要手动启用。请参阅下面拉希尔瓦齐尔的回答。

You can delete localStorage items one by one using Firebug (a useful web development extension) or Firefox's developer console.

Firebug Method

  1. Open Firebug (click on the tiny bug icon in the lower right)
  2. Go to the DOM tab
  3. Scroll down to and expand localStorage
  4. Right-click the item you wish to delete and press Delete Property

Developer Console Method

You can enter these commands into the console:

localStorage; // click arrow to view object's properties
localStorage.removeItem("foo"); 
localStorage.clear(); // remove all of localStorage's properties

Storage Inspector Method

Firefox now has a built in storage inspector, which you may need to manually enable. See rahilwazir's answer below.

如梦亦如幻 2024-11-15 21:17:01

从 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 tools

Updated 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

风和你 2024-11-15 21:17:01

要检查您的 localStorage 项目,您可以在 javascript 控制台(例如 firebug 或在新的 FF 版本中附带的 js 控制台)中输入 console.log(localStorage);

您可以使用这行代码来删除浏览器本地存储内容。只需在 JavaScript 控制台中执行即可:

localStorage.clear();

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.clear();
唯憾梦倾城 2024-11-15 21:17:01

由于“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).

本王不退位尔等都是臣 2024-11-15 21:17:01

现在有一个很棒的 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

清风无影 2024-11-15 21:17:01

我无法直接在 Firefox (v27) 控制台中使用 localStorage。我收到错误:

[异常...“组件不可用”nsresult:“0x80040111(NS_ERROR_NOT_AVAILABLE)”位置:“JS框架::调试器评估代码:::第1行”数据:否]

有效的是:

window.content.localStorage

I could not use localStorage directly in the Firefox (v27) console. I got the error:

[Exception... "Component is not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: debugger eval code :: :: line 1" data: no]

What worked was:

window.content.localStorage
疑心病 2024-11-15 21:17:01

试试这个,它对我有用:

var storage = null;
setLocalStorage();

function setLocalStorage() {
    storage = (localStorage ? localStorage : (window.content.localStorage ? window.content.localStorage : null));

    try {
        storage.setItem('test_key', 'test_value');//verify if posible saving in the current storage
    }
    catch (e) {
        if (e.name == "NS_ERROR_FILE_CORRUPTED") {
            storage = sessionStorage ? sessionStorage : null;//set the new storage if fails
        }
    }
}

Try this, it works for me:

var storage = null;
setLocalStorage();

function setLocalStorage() {
    storage = (localStorage ? localStorage : (window.content.localStorage ? window.content.localStorage : null));

    try {
        storage.setItem('test_key', 'test_value');//verify if posible saving in the current storage
    }
    catch (e) {
        if (e.name == "NS_ERROR_FILE_CORRUPTED") {
            storage = sessionStorage ? sessionStorage : null;//set the new storage if fails
        }
    }
}
凉城已无爱 2024-11-15 21:17:01

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文