166
rated 0 times
[
173]
[
7]
/ answers: 1 / hits: 22355
/ 11 Years ago, wed, february 27, 2013, 12:00:00
I have written a Chrome extension. I cannot use
localStorage.setItem
and localStorage.getItem
for storing and retrieving because background and browser action runs in different environment [as seen here].
So I decided to use the Chrome storage API:
var storage = chrome.storage.local;
var myTestVar = 'somevar';
var obj = {};
obj[myTestVar] = $(#somevar).val();
storage.set(obj);
which produced the following error:
Uncaught TypeError: Cannot read property 'local' of undefined
What am I doing wrong?
More From » google-chrome-extension