use*_*858 2 firefox-addon firefox-addon-webextensions
我能够以某种方式运行这个扩展:
https://github.com/mdn/webextensions-examples/tree/master/beastify
popup/choose_beast.js单击时会调用浏览器图标。
有人可以告诉我为什么这段代码(放置在顶部popup/choose_beast.js)会生成异常:
try{
var ss = require("sdk/simple-storage");
ss.storage.myArray = [1, 1, 2, 3, 5, 8, 13];
}catch(e){
alert('exception');
console.log(e);
}
Run Code Online (Sandbox Code Playgroud)
这是 中的相关条目manifest.json:
"browser_action": {
"default_icon": "icons/beasts-32.png",
"default_title": "Beastify",
"default_popup": "popup/choose_beast.html"
}
Run Code Online (Sandbox Code Playgroud)
我可以通过什么方式将数据存储在此弹出 html 中,以便我可以随时在内容脚本中检索?
另外,这个页面choose_beast.html是在什么上下文中运行的?背景、页面脚本还是内容脚本?
应使用网络扩展storage API来实现此目的。
这是一个用法示例。
| 归档时间: |
|
| 查看次数: |
9775 次 |
| 最近记录: |