26

I have made an advanced functional prototype of a simple web application, and delays have pushed this into the position of going "live".

At the moment, it just uses JavaScript's localStorage facility to keep track of what's happening, but due to paranoia, we don't want it to be corrupted causing loss of data (it certainly feels a bit sketchy never talking to a server).

Where does Firefox keep its localStorage database (I think it's SQLite, but I just can't find it)?

Marco Bonelli
  • 63,369
  • 21
  • 118
  • 128
Stephen
  • 19,488
  • 10
  • 62
  • 83
  • this Q&A may be helpful, though not about firefox specifically http://stackoverflow.com/questions/23587074/access-web-storage-or-indexeddb-from-outside-the-browser-in-android – Stuart Sep 04 '14 at 22:14
  • For a live web app, I'm guessing you have end users, not programmers, inputting data. So rather than have them find and backup a specific file on their machine, why not add JavaScipt to the app that periodically syncs their localStorage contents to the server? – maurice May 22 '15 at 00:03

3 Answers3

30

The DOM storage data is stored in the webappsstore.sqlite file in the profile folder.

§ localStorage

Zombo
  • 1
  • 62
  • 391
  • 407
Vlad
  • 10,602
  • 2
  • 36
  • 38
  • 3
    The profile folder is located in `%APPDATA%\Mozilla\Firefox\Profiles\​`, named something like `321edcba.default`, and within it, there’s the `webappsstore.sqlite`. – dakab Jun 17 '18 at 19:17
  • Check out @Ethan's answer to see the up to date location in `storage/default`. – Tomáš Hübelbauer Jan 08 '23 at 00:44
13

On Mac OS X, the webappsstore.sqlite is located under ~/Library/Application Support/Firefox/Profiles/xxxxxxxx.default/ (where xxxxxxxx is random according to Firefox Profile Tutorial ).

I used the Command Line Shell For SQLite to look around. Assuming www.example.com was a real site and the only site using localstorage, you can run these commands:

$ sqlite3 webappsstore.sqlite
sqlite> .tables
webappsstore2
sqlite> .schema
CREATE TABLE webappsstore2 (scope TEXT, key TEXT, value TEXT, secure INTEGER, owner TEXT);
CREATE UNIQUE INDEX scope_key_index ON webappsstore2(scope, key);
sqlite> select * from webappsstore2;
moc.elpmaxe.www.:http:80|stringkey|value|0|
moc.elpmaxe.www.:http:80|jsonkey|{"key","value"}|0|
sqlite> .exit

See How is HTML5 WebStorage data physically stored? for the Chrome storage location. Chrome uses individual sqlite files per hostname and protocol, where Firefox uses the reversed hostname and protocol in the scope column.

See Where the sessionStorage and localStorage stored? for the Opera storage location. Opera uses an XML index file and individual XML files for the Base64 encoded data.

Community
  • 1
  • 1
Kevin Hakanson
  • 41,386
  • 23
  • 126
  • 155
1

As of LSNG, local storage is also found in the profile directory under storage/default/.

Ethan
  • 111
  • 2
  • 6
  • Thanks! The full path on macOS is `/Users/user/Library/Application Support/Firefox/Profiles/….default-release/storage/default/ls/data.sqlite` and the permissions don't allow opening it from there so make a copy to read it (it has no password). – Tomáš Hübelbauer Jan 08 '23 at 00:43