DEV Community

Latz
Latz

Posted on

Firefox Addon: Add options menu to browser action icon

Especially during development it’s annoying to reach the option page of a Firefox addon:

  1. Hamburger
  2. Addons and Themes
  3. ...
  4. Options

There should be a faster way. At least for your own Add-ons you can quite easily add an “Options” menu item to the browser action:

browser.contextMenus.create({
    title: 'Options',
    contexts: ['browser_action'],
    onclick: () => {
      browser.runtime.openOptionsPage();
    },
  });
Enter fullscreen mode Exit fullscreen mode

Additionally to have to add a new permission to the manifest.json file:

"permissions": ["contextMenus"],
Enter fullscreen mode Exit fullscreen mode

menu

That was easy!

Discussion (0)