0

I'm looking at JS code that uses localStorage.getItem() and localStorage.setItem(). It's storing items somewhere, but I can't find out where.

When I go here (using Mac Chrome):

~/Library/Application Support/Google/Chrome/Default/Local Storage/

there is leveldb but I can't find where the exact items are being stored.

This is the exact code:

if (!localStorage.getItem('myapp')){
    localStorage.setItem('myapp', JSON.stringify({next: 0, items: []}));
}
4
  • 3
    In Chrome in Developer tools, the Tab Application has it there. Commented Jan 27, 2019 at 21:15
  • @Our_Benefactors Ah, yes.. Well it looks like the correct directory.. OP: Are you saying there are no files in that directory? Commented Jan 27, 2019 at 21:27
  • @Keith there are .ldb files, manifest file and log file. Is it one of the .ldb files? (I have to look through all of them and look for the one that was set through the JS code?) Commented Jan 27, 2019 at 21:43
  • @Keith Alex put a good link and Daniel answered it below. Their answer was what I needed. Thanks. Commented Jan 27, 2019 at 21:45

1 Answer 1

2

For example in Google Chrome:

1) open console.

2) go to the Application

3) open storage -> local storage

4) you should see a table with keys and values

enter image description here

If you asking about "when it is stored on computer disc" it depends from browser and system:

How is HTML5 WebStorage data physically stored?

Where does PERSISTENT file system storage store with chrome?

Where in the filesystem does IE8 store values stored in localStorage?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.