English 中文(简体)
Where does Firefox store javascript/HTML localStorage?
原标题:

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

最佳回答

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

§ localStorage

问题回答

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.

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





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签