0

So I know you can add a little icon in the top right for extensions, it's really neat, it's a popup. My question is how you you edit the right click menu on it, I can't seem to find something that helps for the life of me. When I right click I get a menu with the name of my extension, but when I click on it, it takes me to a random extension page.

M3diik
  • 5
  • 1

1 Answers1

4

You can add it using context menu like this:

1) Add "permissions": ["contextMenus"]in manifest.json

2) In background.js, add:

chrome.contextMenus.create({
      title: "hello",
      contexts: ["browser_action"],
      onclick: function() {
        alert('Hello, world!');
      }
});

3) This adds "hello" into the menu when you right click on your icon:

enter image description here

4) The action specified by the onclick function:

enter image description here

jianweichuah
  • 1,417
  • 1
  • 11
  • 22