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?
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:
Open your extension's background page by going to
chrome://extensions/
("Developer mode" needs to be checked to see background pages)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.
storage
is undefined –
Forborne chrome.storage.sync.get(console.dir)
shows a formatted view –
Degree 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.
I did not write this, but it was suggested by the author on some other SO question.
chrome.storage
you can open dev tools for background.js of your extension then click on the storage explorer in that window. –
Olander chrome.storage
as of Chrome 80 (March 2020) –
Third 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.
storage
is undefined –
Forborne This was actually two questions!
- 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)
- 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)})
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 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 storage
is undefined –
Forborne 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.
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 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)
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.
You should try the latest Storage Area Viewer. It’s more modern and feature-rich. You’ll definitely come back to thank me.
© 2022 - 2024 — McMap. All rights reserved.
chrome.storage.local.get(console.log)
. There's alsochrome.storage.sync.get(console.log)
! – Father