I\'m trying to access the localStorage
object from my chrome extension\'s background.js
file. The localStorage
object on a regular web
The localStorage
object is relative to the "local environment", this means that the localStorage
object on http://www.google.com
is totally different from the one on http://stackoverflow.com
, and obviously is totally different from the one in the background page of your extension.
Given that, if you want to store something in your extension, you'll need to use the localStorage
object in your background page, not in the page of some site you are injecting content scripts to.
If you want to access web pages' localStorage
s, then you'll have to send a content script on it, retrieve the localStorage
object, and send it to the background.js
script with a message (see chrome extensions message passing).
Documentation on localStorage
from MDN: here.