遇到了一个大问题,当我用我的选项页面更新我的localStorage时,没关系,存储了新的值但是我的background.js保留了第一个加载的值,即使我输入了类似的东西:
var value = localStorage['item'];
当我刷新扩展程序时,它很好但很烦人......
有什么问题吗?
此致
答案 0 :(得分:6)
// the following line will only be executed when the extension first loads
var value = localStorage['setting'];
function updateSetting () {
value = localStorage['setting'];
}
选项
localStorage['setting']=Math.random();
chrome.extension.getBackgroundPage().updateSetting();