简体   繁体   English

Firefox 在哪里存储 javascript/HTML localStorage?

[英]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".我已经制作了一个简单的 web 应用程序的高级功能原型,延迟已将其推向“上线”的 position。

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).目前,它只使用 JavaScript 的localStorage工具来跟踪正在发生的事情,但由于偏执狂,我们不希望它被损坏而导致数据丢失(从不与服务器通信肯定感觉有点粗略)。

Where does Firefox keep its localStorage database (I think it's SQLite, but I just can't find it)? Firefox 将其localStorage数据库保存在哪里(我认为它是 SQLite,但我找不到它)?

The DOM storage data is stored in the webappsstore.sqlite file in the profile folder. DOM 存储数据存储在配置文件文件夹中的webappsstore.sqlite文件中。

§ 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 ).在 Mac OS X 上, webappsstore.sqlite位于~/Library/Application Support/Firefox/Profiles/xxxxxxxx.default/下(其中 xxxxxxxx 根据Firefox Profile Tutorial是随机的)。

I used the Command Line Shell For SQLite to look around.我使用命令行 Shell For SQLite环顾四周。 Assuming www.example.com was a real site and the only site using localstorage, you can run these commands:假设 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

See How is HTML5 WebStorage data physically stored?请参阅HTML5 WebStorage 数据如何物理存储? for the Chrome storage location. Chrome 存储位置。 Chrome uses individual sqlite files per hostname and protocol, where Firefox uses the reversed hostname and protocol in the scope column. Chrome 根据主机名和协议使用单独的 sqlite 文件,其中 Firefox 在 scope 列中使用相反的主机名和协议。

See Where the sessionStorage and localStorage stored?请参阅sessionStorage 和 localStorage 存储在哪里? for the Opera storage location.用于 Opera 存储位置。 Opera uses an XML index file and individual XML files for the Base64 encoded data. Opera 对 Base64 编码数据使用 XML 索引文件和单独的 XML 文件。

On Windows, you can find it in here在 Windows 上,你可以在这里找到它

%appdata%\Mozilla\Firefox\Profiles\???????.default\webappsstore.sqlite

See MDN page on Window.localStorage :请参阅Window.localStorage 上的 MDN 页面

Starting with iOS 5.1, Safari Mobile stores localStorage data in the cache folder从 iOS 5.1 开始,Safari Mobile 将 localStorage 数据存储在缓存文件夹中

As of LSNG , local storage is also found in the profile directory under storage/default/ .LSNG 开始,本地存储也可以在storage/default/下的配置文件目录中找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM