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?
相关问题
- Browsers render final comma of right-to-left (rtl)
- Chrome dev tools exact computed value for CSS rule
- Chrome dev tools exact computed value for CSS rule
- Change Chromium icon and “chrome” text to custom i
- debugging webgl in chrome
相关文章
- Is there a way to hide the new HTML5 spinbox contr
- Google Chrome Cache
- how to download a file on Chrome without auto rena
- Do all browsers on iOS use WKWebview or UIWebVIew?
- Why does Google Chrome NOT use cached pages when I
- Calling Chrome web browser from the webbrowser.get
- localStorage data persistence
- Progressive web app(PWA) vs Electron vs Browser ex
This was actually two questions!
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)
In the same console of the background page:
chrome.storage.local.get(function(result){console.log(result)})
chrome.storage.sync.get(function(result){console.log(result)})
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.
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(function(result){console.log(result)})
This will spit the whole storage as a JSON object into the console.
There is a very helpful extension to work with both
localStorage
andchrome.storage
that I recently discovered, that works as a Dev Tools panel.Storage Area Explorer
I did not write this, but it was suggested by the author on some other SO question.
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:
This will spit the JSON object into console.
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.