我创建了一个Chrome扩展程序。我想知道是否可以在Chrome扩展程序的图标中添加右键单击选项。
当我在右键菜单列表中单击右键时,它应该显示chrome扩展程序图标及其名称。
如何使用Chrome Web Developer做到这一点?
答案 0 :(得分:1)
>>> I think you are looking for Contextmenus.
1) Update extension's menifest.json with
"background": {
"scripts": ["menus.js"], //menu.js will include the code to crate the context
"persistent": false
},
"permissions": ["contextMenus"],
"icons":{
"128": "contexticon.png"
}
2) Write code in menu.js
var contextMenuItem = {
"id": "iconid",
"title": "iconTitle",
"contexts": ["all"] // type of context
};
chrome.contextMenus.create(contextMenuItem);
Note: The options for context menus are: "all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher", "browser_action", or "page_action"