How is HTML5 WebStorage data physically stored?

后端 未结 3 538
执笔经年
执笔经年 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:07

    Just wanted to contribute for IE 11. The localstorage is stored in: C:\Users[YOUR USER ACCOUNT]\AppData\LocalLow\Microsoft\Internet Explorer\DOMStore

    However, it is hidden by default. To show this folder you have to: Folder Options --> Uncheck "Hide protected operating system file" Back to folder, you will see some sub folder inside. Go to each folder will see some XML files according for websites.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2020-12-01 15:13

    Chrome uses SQLite for LocalStorage.

    I confirmed this by going to AppData\Local\Google\Chrome\User Data\Default\Local Storage on my local PC and viewing the contents of a file. The files start with "SQLite format 3" when viewed via a text editor. You will need a SQLite database viewer to view the data.

    0 讨论(0)
提交回复
热议问题