17

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 WebStorage for debugging and trouble-shooting purposes.

I was wondering if it is possible to view the contents of web storage in the file system. Is this content stored in text files on the file system that are in some standard location? Or is this data stored in some proprietary binary format by the various browsers and is not designed to be accessible or viewable by browsing the file system?

My motivation for asking this question is to see if you can view the content of WebStorage on the file system as an aid to development and debugging, and also just out of curiosity too see how this data is actually stored.

Thanks.

Kevin Hakanson
  • 41,386
  • 23
  • 126
  • 155
Joe Alfano
  • 10,149
  • 6
  • 29
  • 40
  • You may find http://www.w3schools.com/html5/html5_webstorage.asp helpful. – Hope4You Mar 12 '12 at 14:55
  • 4
    @Hope4You — Unlikely since (a) it is w3schools (and therefore awful) and (b) entirely focused on the APIs provided by browsers and not on their internals – Quentin Mar 12 '12 at 15:29

3 Answers3

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.

Pavel Oganesyan
  • 6,774
  • 4
  • 46
  • 84
Kyle Nunery
  • 2,048
  • 19
  • 23
  • Thanks Nunnery, that is great information! Do you have any ideas about Firefox or IE? – Joe Alfano Mar 14 '12 at 19:30
  • FireFox uses SQLite databases as well for HTML5 WebStorage. I recommend using [FireFoxes SQLite Manager addon](https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/) to view SQLite databases on your local filesystem. – Kyle Nunery Mar 15 '12 at 04:25
8

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.

Community
  • 1
  • 1
Kevin Hakanson
  • 41,386
  • 23
  • 126
  • 155
3

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.

NangSaigon
  • 1,253
  • 12
  • 14