我想保存并加载单选按钮检查状态,但我收到此错误"无法读取属性' local'未定义"这是我的代码
Popup.js
function SaveData(){
alert("Save Data Enter");
var rb1 = document.getElementById("rbox").checked;
var rb2 = document.getElementById("rbox2").checked;
console.log(rb1);
console.log(rb2);
chrome.storage.local.set({'value': rb1}, function() {
// Notify that we saved.
console.log('Settings saved');
});
}
rb1和rb2显示为true / false但chrome.storage.local.set
给出错误我也在menifest.json中给出了存储权限,但不知道为什么会出现此错误
menifest.json
{
...
"permissions": [
"tabs", "<all_urls>" , "storage", "webNavigation"
],
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
...
}
修改:2
修改-3 jsFiddle link