Add right click option to chrome extension's icon

爱⌒轻易说出口 提交于 2021-02-07 06:20:07

问题


Most of these questions seem to pertain to adding a right click to elements and pages using context menus. I would like to know if it is possible to add a right click option to a Chrome extension's icon. I.e. put an option such as "Documentation" between "Options" and "Disable"


回答1:


There is no API for that currently and I am not aware of any in the works.

If there was anything, it would be in the Browser Action or Page Action documentation.




回答2:


You can use Chrome create contextMenus API and set contexts="browser_action"

Example

chrome.contextMenus.create({
  "type":"checkbox",
  "checked":true,
  "title":"Connect via Cloud",
  "contexts":["browser_action"],
  "onclick":function(info, tab) {
      console.log(info);
  }
});


来源:https://stackoverflow.com/questions/12083638/add-right-click-option-to-chrome-extensions-icon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!