Tag: google chrome storage

chrome.storage.sync未定义?

我试图通过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); }); }