I'm trying to use chrome storage in an extension, via a content_script, but I keep failing on
Uncaught TypeError: Cannot read property 'sync' of undefined
This is my code:
testChromeStorage();
function testChromeStorage() {
console.log("Saving");
chrome.storage.sync.set({'value': theValue}, function() {
message('Settings saved');
});
chrome.storage.sync.get("value", function (retVal) {
console.log("Got it? " + retVal.value);
});
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…