'Add right click option to chrome extension's on web page
I have created a chrome extension. I would like to know if it is possible to add a right-click option to a Chrome extension's icon.
When I click right on-page in right-click menulist it should show chrome extension icon and its name.
How do I do that using Chrome Web Developer?
Solution 1:[1]
I think you are looking for Contextmenus.
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"
}
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"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | DaImTo |
