我正在尝试通过 content_script 在扩展中使用 chrome 存储,但我一直失败
Uncaught TypeError: Cannot read property 'sync' of undefined
这是我的代码:
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);
});
}