2011-08-16 80 views
19

我已經提出了一個簡單的Web應用程序的高級功能原型,並且延遲將它推到了「實時」的位置。Firefox在哪裏存儲JavaScript/HTML localStorage?

目前,它只是使用HTML5的localStorage工具來跟蹤發生了什麼,但由於偏執狂,我們不希望它損壞和丟失數據(它肯定感覺有點粗略,從來沒有與服務器交談.. 。)

哪裏火狐保持它的localstorage數據庫(我認爲這是sqlite的,但我無法找到它...)

+0

這個Q&A可能會有所幫助,但不是關於Firefox專門http://stackoverflow.com/questions/23587074/access-web-storage-or-indexeddb-from-outside-the-browser-in-android – Stuart

+0

對於一個真實的web應用程序,我猜你有最終用戶,而不是程序員,輸入數據。因此,爲了不讓他們在他們的機器上查找和備份特定文件,爲什麼不將JavaScipt添加到定期同步其localStorage內容到服務器的應用程序中? – maurice

回答

20

的DOM存儲的數據存儲在webappsstore.sqlite文件中的配置文件 文件夾。

§ localStorage

5

在Windows中,您可以在這裏

 
%appdata%\Mozilla\Firefox\Profiles\xxxxxxx.default\webappsstore.sqlite 
7

在Mac OS X中發現,該webappsstore.sqlite位於~/Library/Application Support/Firefox/Profiles/xxxxxxxx.default/下(其中xxxxxxxx根據Firefox Profile Tutorial是隨機的)。

我用Command Line Shell For SQLite去環顧四周。假設www.example.com是一個真正的網站,並使用本地存儲中的唯一網站,你可以運行這些命令:

$ 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 

針對Chrome存儲位置見How is HTML5 WebStorage data physically stored?。 Chrome針對每個主機名和協議使用單獨的sqlite文件,其中Firefox在範圍列中使用顛倒的主機名和協議。

有關Opera存儲位置的信息,請參閱Where the sessionStorage and localStorage stored?。 Opera爲Base64編碼數據使用XML索引文件和單個XML文件。