How is HTML5 WebStorage data physically stored?

后端 未结 3 626
执笔经年
执笔经年 2020-12-01 14:18

In using the HTML5 WebStorage functionality, I know that certain browsers, like Chrome, have developer tools that enable users to browse thru the contents of their WebStorag

3条回答
  •  攒了一身酷
    2020-12-01 15:08

    On Mac OS X, this was at ~/Library/Application Support/Google/Chrome/Default/Local Storage

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

    $ sqlite3 http_www.example.com_0.localstorage
    sqlite> .tables
    ItemTable
    sqlite> .schema
    CREATE TABLE ItemTable (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB NOT NULL ON CONFLICT FAIL);
    sqlite> select * from ItemTable;
    stringkey|value
    jsonkey|{"key","value"}
    sqlite> .exit
    

    See Where does firefox store javascript/HTML localStorage? for the Firefox storage location.  Chrome uses individual sqlite files per hostname and protocol, where Firefox uses a single webappsstore.sqlite file with the reversed hostname and protocol in a 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.

提交回复
热议问题