Reputation: 1221
I'm able to run this extension somehow:
https://github.com/mdn/webextensions-examples/tree/master/beastify
On clicking the Browser Icon popup/choose_beast.js
is invoked.
Can somebody tell me why this code(placed in the top of popup/choose_beast.js
) is generating exception:
try{
var ss = require("sdk/simple-storage");
ss.storage.myArray = [1, 1, 2, 3, 5, 8, 13];
}catch(e){
alert('exception');
console.log(e);
}
Here is the relevant entry in the manifest.json
:
"browser_action": {
"default_icon": "icons/beasts-32.png",
"default_title": "Beastify",
"default_popup": "popup/choose_beast.html"
}
What is the way I can store the data in this popup html so that I can retrieve anytime in the content script?
Also under which context is this page choose_beast.html running? Background, page script or content script?
Upvotes: 3
Views: 10304
Reputation: 1263
A web-extension should be using storage API
for this purpose.
Here is an example usage.
Upvotes: 6