193

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?

Dharman
  • 30,962
  • 25
  • 85
  • 135
Ryan
  • 9,821
  • 22
  • 66
  • 101
  • 2
    possible duplicate of [Firefox addon to view/edit/create localStorage data?](http://stackoverflow.com/questions/3125980/firefox-addon-to-view-edit-create-localstorage-data) – onteria_ May 21 '11 at 20:00
  • Possible,but going to that link I installed that plugin and it does nothing for me :( – Ryan May 21 '11 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. – Luca Reghellin Jun 07 '17 at 15:25

8 Answers8

274

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.

AlexMA
  • 9,842
  • 7
  • 42
  • 64
  • Is there any way to delete all the items in local storage, without the need to click (twice) every line? – Pavel S. Jan 14 '12 at 13:46
  • 6
    you can type localStorage = []; using your java console – Thariama Dec 03 '12 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 Jun 13 '13 at 07: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. – Richard Turner Sep 17 '13 at 13:44
  • Note that in firefox 34 ( release date: december 2014 ) Storage is supported. Is disable by default but you can go to toolbox options in the console and activate it. – rahpuser May 14 '15 at 15:17
  • 2
    @Thariama s/java console/javaScript console – tuxayo Feb 06 '17 at 21:25
  • I was trying to inspect storage for an extension I had written. I couldn't find it via the developer console but could find it by inspecting the extension: In the address bar, go to: about:debugging > This Firefox – Oliver P Oct 17 '22 at 09:24
53

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

Rahil Wazir
  • 10,007
  • 11
  • 42
  • 64
  • 5
    As of Firefox 38, unfortunately the Storage Inspector is read only. – tagawa May 26 '15 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 https://www.elegantthemes.com/blog/resources/everything-you-need-to-know-about-firefox-developer-tools – Rahil Wazir May 26 '15 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 Jan 24 '17 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. – Peter Bašista Nov 10 '20 at 06:20
42

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();
Thariama
  • 50,002
  • 13
  • 138
  • 166
  • 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. – Richard Turner Sep 17 '13 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 Dec 19 '13 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 Oct 01 '16 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).

Eddie Kumar
  • 117
  • 1
  • 2
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

Fractalf
  • 5,228
  • 3
  • 23
  • 26
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
Dharman
  • 30,962
  • 25
  • 85
  • 135
myusuf
  • 11,810
  • 11
  • 35
  • 50
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
        }
    }
}
E. Varela
  • 25
  • 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 Feb 10 '16 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 Feb 11 '16 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 Feb 11 '16 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 Feb 11 '16 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.

Astral1990
  • 413
  • 5
  • 6