Cleaner Firefox Context Menus Using Stylish

Since the Firefox Menu Editor extension doesn’t get along with the new HTML5 context menu support in Firefox 8 and up (it prevents site-added entries from appearing with no option to allow them), I thought I’d whip up a few userstyles to get the same, more Chrome-like (useful, but cruft-free) context menu I normally have without sacrificing that feature.

Here are the ones I’ve written:

The one to clean out Firefox-native entries is especially important to me since Firefox devs seem to care more about moving the RSS icon out of the address bar (fix) and hiding behind their toolbar heatmaps than even doing a heatmap study on the context menu. I seriously doubt things like “Send Image…” get used often enough to be in the top level of a context menu without Chrome’s “one entry or submenu per extension” rule. (And why is “Select All” not shown only in text fields in this day and age?)

If you want to make your own, the process is very simple. Use mine as an example and then follow the instructions on Mozillazine’s Menu customization page.

If you want to remove something with a name that changes based on what you select or you want to “do it right” so your script works for everyone, rather than just people who share your locale, follow the “Using ID selectors” instructions rather than the “Using attribute selectors” ones. Finding the ID is a bit technical, but, here’s how I do it:

  • locate your profile folder, then go into the extensions folder.
  • One of those files or folders holds the code to the extension, so use your favorite archive tool to poke around until you find the right one. (.xpi files are .zip files with a different extension, so use your favorite archive tool)
  • Use grep -r "text from the menu item" path/to/unpacked/xpi or a grep-like tool to find the file and line number to start at. (If you get no results, try a smaller fragment)
  • Go to that line number in that file using your favorite text editor. The ID should be nearby, either as id="waggawagga" or in a bit of Javascript which looks up the object by ID

CC BY-SA 4.0 Cleaner Firefox Context Menus Using Stylish by Stephan Sokolow is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

This entry was posted in Geek Stuff. Bookmark the permalink.

5 Responses to Cleaner Firefox Context Menus Using Stylish

  1. briceorbryce says:

    This is good stuff. I recently (5 hours ago) started looking for a replacement for Menu Editor because it clashes with FireGestures in a sort of funny way (arrows appear on the menu). So now I have 5 options on my right-click menu: Back, Forward, Reload, Close Tab, and NoScript. I guess NoScript is fine for the moment since the Chrome element names and IDs page didn’t have that specific ID.

  2. Mike says:

    Just awesome. Thanks so much for this, works way better than Menu Editor with FF20! 🙂

    Here are a few more menu items that I managed to hide:

    Evernote Web Clipper: #webclipper3-contextmenu, #webclipper-contextmenu-sep
    Evernote Clearly: #readable_by_evernote__context_menu
    NoSquint: #nosquint-menu-settings

    So now my overall user style looks like:

    @namespace url(;

    #context-sendlink, #context-sendimage, #context-sendpage,
    #context-sendvideo, #context-stop, #context-bookmarkpage,
    #context-viewbgimage, #context-setDesktopBackground,
    #context-sep-viewbgimage, #webclipper3-contextmenu,
    #webclipper-contextmenu-sep, #readable_by_evernote__context_menu,
    #nosquint-menu-settings {
    display: none !important;

    Also note that if you don’t have grep you can usually find the menu item ID in the extension’s /chrome/content/(something).xul file, under the XML node “contentAreaContextMenu” (do a search for “context” and you should find it).

    • Nice!

      Have you considered making the Evernote part a new userscript and reporting the lack of configurability in noSquint as a bug?

      That way, you could put up the Evernote script on the way I did with the StumbleUpon part and you’d still have the option of subscribing to updates to the one for core Firefox menu items. (eg. Suppose they add a new menu item like when they added “Send Video…”)

Leave a Reply

Your email address will not be published. Required fields are marked *

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution under the same terms as the associated post.