196

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?

3
  • 2
    possible duplicate of Firefox addon to view/edit/create localStorage data?
    – onteria_
    Commented May 21, 2011 at 20:00
  • Possible,but going to that link I installed that plugin and it does nothing for me :(
    – Ryan
    Commented May 21, 2011 at 22:22
  • 5
    To the people who closed this question: this is a good question despite the rules (not always rules are good), voted by hundreds of users (both the question and the accepted answer). No reason to close it. You should reopen it. Commented Jun 7, 2017 at 15:25

8 Answers 8

275

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.

7
  • Is there any way to delete all the items in local storage, without the need to click (twice) every line?
    – Pavel S.
    Commented Jan 14, 2012 at 13:46
  • 6
    you can type localStorage = []; using your java console
    – Thariama
    Commented Dec 3, 2012 at 15:52
  • this is broken beyond hope. download a movie in mega.co.nz and click DOM in firebug... see firefox going down in flames.
    – gcb
    Commented Jun 13, 2013 at 7:14
  • 4
    Note that in recent versions Firefox has a built-in JavaScript console ("Web Console"), so one doesn't have to install Firebug to do this. Commented Sep 17, 2013 at 13:44
  • 2
    @Thariama s/java console/javaScript console
    – tuxayo
    Commented Feb 6, 2017 at 21:25
54

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

4
  • 5
    As of Firefox 38, unfortunately the Storage Inspector is read only.
    – tagawa
    Commented May 26, 2015 at 11:35
  • 4
    @tagawa The Storage Inspector is read only by default, but Firefox has said that it’s working on developing the tool so that developers will be able to edit their storage contents in the future. See elegantthemes.com/blog/resources/… Commented May 26, 2015 at 12:55
  • 2
    A note to users of the German localized version of Firefox. In the Default Firefox Developer tools you find the item "Speicher" twice. The second one is the Storage Manager.
    – Waruyama
    Commented Jan 24, 2017 at 12:53
  • 2
    As of Firefox 82, editing of local storage is possible. However, the values displayed in the storage inspector are truncated to a certain size and if they are larger, it is not possible to read or copy their full value from there. Commented Nov 10, 2020 at 6:20
43

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();
3
  • 2
    Note that in recent versions Firefox has a built-in JavaScript console ("Web Console"), so one doesn't have to install Firebug to do this. Commented Sep 17, 2013 at 13:43
  • 4
    Firefox now also has inspect(Object) which works on localStorage, and gives a nice editable tree-view of the data stored in it.
    – rfinz
    Commented Dec 19, 2013 at 21:05
  • That work, but only for the domain in the tab. What if you want to display the local storage without filtering?
    – mins
    Commented Oct 1, 2016 at 10:25
10

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).

0
9

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

1
  • This extension is no longer available.
    – Mast
    Commented Nov 1, 2022 at 21:05
5

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
0

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
        }
    }
}
4
  • 1
    Code is ok. Code + "try this" with no actual explanation makes no improvement. Now, if you add that missing explanation so that future users actually learn something, THEN you'd have a good answer.
    – Mogsdad
    Commented Feb 10, 2016 at 21:08
  • Here is the code with comments in English: var storage = null; setLocalStorage(); function setLocalStorage() { storage = (localStorage ? localStorage : (window.content.localStorage ? window.content.localStorage : null)); try { storage.setItem('test_key', 'test_value');//evaluate 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 } } }
    – E. Varela
    Commented Feb 11, 2016 at 14:57
  • Some browsers, like Firefox, show "NS_ERROR_FILE_CORRUPTED" error, then another option must to be implemented because clearing cache is not the solution neither "window.content.localStorage" as another resource
    – E. Varela
    Commented Feb 11, 2016 at 15:06
  • 1
    Great! Just edit the answer with that information, so it all flows together, and it will be a good answer.
    – Mogsdad
    Commented Feb 11, 2016 at 15:47
-1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.