在被迫使用浏览器一段时间并发现我实际上非常喜欢它之后,我正在尝试创建我的第一个 Edge 扩展。
我的扩展只在页面上显示了一个新的上下文菜单条目。扩展在 Edge 中加载并与元数据(描述、版本等)一起出现在扩展窗格中,但是当我右键单击页面时上下文菜单本身不会显示。
任何熟悉 Edge 扩展的人都知道为什么吗?这是代码。
index.js
browser.contextMenus.create({
id: "MyMenu",
title: "My Context Item",
contexts: ['page']
});
browser.contextMenus.onClicked.addListener(function(info, tab) {
if (info.menuItemId == "MyMenu") {
Code goes here;
}
});
清单.json
{
"manifest_version": 2,
"name": "MyMenu",
"version": "1.0.0",
"description": "My Menu.",
"author": "Oliver Marshall",
"permissions": ["contextMenus"],
"background": {
"scripts": ["index.js"],
"persistent": true
}
}
这是相当样板的东西,实际上它是样板的东西。