chrome插件 - storage的使用
manifest.json
"permissions": [
"storage"
]
popup.js
var data = {
"url": "http://127.0.0.1"
};
chrome.storage.local.set({ "data": data }, function(){
console.log("设置local值成功");
console.log(data);
});
chrome.storage.local.get(["data"], function(result){
alert(result["data"].url);
});