How do I view the storage of a Chrome Extension I've installed?
C

8

119

It seems like it should be possible to view the localStorage/chrome.storage of Chrome Extensions installed on my browser. I've played around with the Developer Tools a bit, but haven't found a way to do this. Any ideas?

Carty answered 12/8, 2012 at 14:32 Comment(0)
G
123

I will proceed to amalgamate the existing knowledge present in several answers, into a simple and comprehensive one. If you vote up this one, please do the same with the ones from @mwkwok and @chaohuang.

It is true that stuff saved using chrome.storage does not show up in developer tools, there you can only see stuff saved using regular localStorage API. Do this:

  1. Open your extension's background page by going to chrome://extensions/ ("Developer mode" needs to be checked to see background pages)

  2. Go to the Console tab and type this:

chrome.storage.local.get(console.log)

This will spit the whole storage as a JSON object into the console.

Gulch answered 11/12, 2014 at 21:7 Comment(3)
The slightly shorter equivalent is chrome.storage.local.get(console.log). There's also chrome.storage.sync.get(console.log)!Father
It says storage is undefinedForborne
chrome.storage.sync.get(console.dir) shows a formatted viewDegree
B
111

There is a very helpful extension to work with both localStorage and chrome.storage that I recently discovered, that works as a Dev Tools panel.

Storage Area Explorer

enter image description here

I did not write this, but it was suggested by the author on some other SO question.

Boarer answered 11/12, 2014 at 23:1 Comment(13)
Wish I could +50 this.Someday
I tried this out, but it's not working for me. However, I'm actually developing a Chrome "devtools" extension - not a normal Chrome extension.Hifi
@Hifi Try opening the Dev Tools for your Dev Tools. Undock, Ctrl+Shift+I. ..wait, I tried. Do not do this with Storage Area Explorer if you're epileptic!Boarer
Yeah I noticed the same thing :)Hifi
This appears to be broken now.Grissom
Works great! (Tested with my own unpacked extension in development)Hallmark
If you wish to see the data items from chrome.storage you can open dev tools for background.js of your extension then click on the storage explorer in that window.Olander
To me it does not show content of chrome.storage as of Chrome 80 (March 2020)Third
add the native way to access and then promote the extension if it worksHeliotaxis
@CodingEdgar Not sure why you're angry at me for that. Other answers cover manual "run a snippet of code" answers. There isn't a native DevTools interface for it.Boarer
Sorry @Boarer , didn't mean to be rude, I just thought that it could be a good way to improve your answer. stating the fact there's no native way and then promoting the extension is a more complete answer, otherways it looks just like promo, not angry at you at all, cheers.Heliotaxis
Am I doing something wrong? This has too many upvotes, but when I install and open the Storage Explorer, all I can see is the local storage and session storage tabs... There's no option to view an extension's storage...Propertius
@Propertius Seems not to work with service worker based extensions, sadly.Boarer
C
69

You're right that chrome.storage does not show up in developer tools. The only way I've found to view all of it is by putting this into console:

chrome.storage.local.get(function(result){console.log(result)})

This will spit the JSON object into console.

Chickaree answered 2/4, 2014 at 21:13 Comment(1)
It says storage is undefinedForborne
F
50

This was actually two questions!

  1. How do I view localStorage of a Chrome Extension I've installed?

Open the Chrome Devtool by clicking on the background page of an extension in Chrome://extensions/ (Developer mode needs to be checked to see background pages), then in resource panel you can see the local storage on the left. (by chaohuang and Kil)

  1. How do I view chrome.storage of a Chrome Extension I've installed?

In the same console of the background page:

OPEN THE BACKGROUND PAGE FIRST:

a. to go to chrome://extensions/

b. ensure you are in development mode

c. then on your extension, either click "Inspect views background page" or go to "Details" and click background page.

NOW THAT YOU ARE ON THE BACKGROUND PAGE YOU CAN PROCEED:

  • For storage.local (by mwkwok)

chrome.storage.local.get(function(result){console.log(result)})

  • For storage.sync

chrome.storage.sync.get(function(result){console.log(result)})

Fosque answered 5/6, 2018 at 1:27 Comment(8)
Should be accepted as the correct answer, the answer below requires an Add-on to be installed and doesn't work.Flea
With Chrome 80 I get following error when trying to use chrome.storage.local.get in the console: Uncaught TypeError: Cannot read property 'local' of undefined at <anonymous>:1:16. The chrome.storage value is undefined in the console.Third
@suma Did you try it in a console of a normal page?Fosque
I see now. I need to open the backround page, as written in the answer. Perhaps the answer could include how to navigate to the background page, for naive users like me who have no idea what it is.Third
@Third The way to do this is to go to chrome://extensions/, ensure you are in development mode, then on your extension, either click "Inspect views background page" or go to "Details" and click background page. Then you can access your variables.Mantelet
It says storage is undefinedForborne
upvoting as the correct answer. it's not the shortest, but it is the most detailed. sometimes when you've reached the end of the rabbit hole and are exhausted it's nice to have verbose, obvious instruction.Encaenia
also, note for 2021: 'inspect view' works for service workers, in the case you've updated your extension for MVC3Encaenia
P
19

Open the Chrome Devtool by clicking on the background page of an extension in Chrome://extensions/ (Developer mode needs to be checked to see background pages), then in resource panel you can see the local storage on the left.

Prophet answered 12/8, 2012 at 15:23 Comment(5)
You can find it in Chrome Developers Tool if you use LocalStorage API. But if you use chrome.storage API method like chrome.storage.local.set({"key":value}), data is not stored in there. Where can we find those datas?Salado
Not seeing anything my extension saved. Other than just print it out, is there another way to check them out?Resistance
Check out recently added answer from @Xan.Someday
Does this even work? What you see there is the HTML5 storage, not chrome.storage storageNasia
Can't see anything of the sortForborne
U
15

In 2022, the best way I've found is still with the console.log, but you can make it a lot cleaner-looking with currying. Open up extensions page, open the inspector for your background worker, go to console, and...

chrome.storage.local.get(console.log)

Uncommon answered 5/2, 2022 at 18:3 Comment(0)
A
9

I didn't get any results using the provided code typed into console. But this code worked when put into the console.

chrome.storage.sync.get(null, function (data) { console.info(data) });

The difference here is that we pass a null value which will return all content in the storage. To back this up, and for additional reading, check out the official chrome page on this API.

Avowed answered 23/10, 2016 at 9:56 Comment(0)
W
-1

You should try the latest Storage Area Viewer. It’s more modern and feature-rich. You’ll definitely come back to thank me.

Storage Area Viewer

Worl answered 22/3 at 12:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.