Tech Journal Back to Tech Journal

How can I remove items from Firefox's context menu?

I don't like it when I accidentally press on the "Send Link" button (since it launches my e-mail program, which can take several seconds,) so I wanted to remove it. (I recommend making a backup of any *.jar files you modify. Just in case.)

Here's how:

  1. First, we find out the name of the commend. For example, let's say you want to remove the "Send Link..." menu item. Then you need to go to the Firefox install directory, and look inside the chrome directory. Search inside the *.jar files for the string "Send Link...". I found it (in Firefox 2.0) in en-US.jar; inside that archive, there was a file locale/browser/browser.dtd with the following line:
    <!ENTITY sendLinkCmd.label            "Send Link...">
    The name of the command is sendLinkCmd.label. That's what we are going to search for next.
  2. Next, we search for the name of the command inside the *.jar files in the chrome directory, and just comment out all of the menuitem entries using <!-- before and --> after.

    So, in the above example I found many entries in the archive browser.jar, in a file content/browser/browser.xul inside that archive. Such as the following:

    <menuitem id="context-sendlink"
    label="&sendLinkCmd.label;"
    accesskey="&sendLinkCmd.accesskey;"
    oncommand="gContextMenu.sendLink();"/>

    So I commented it out:

    <!--
    <menuitem id="context-sendlink"
    label="&sendLinkCmd.label;"
    accesskey="&sendLinkCmd.accesskey;"
    oncommand="gContextMenu.sendLink();"/>
    -->
  3. Finally, repack all the modified files back into the jar-archive, and restart Firefox.
Last updated on 2008-08-15 04:42:19 -0700, by Shalom Craimer

Back to Tech Journal