Home » Hacking, How to Recipies, Internet Browser » Tweaking: Edit Firefox Context Menu

Tweaking: Edit Firefox Context Menu

You can customize Firefox menu by using 3rd party tools but if you want to tweak menus yourself than the following tutorial is for you.

You can tweak your menus using userChrome.css file. userChrome.css is a CSS file that can be used to change the way Mozilla Firefox interface look. But to edit it you need to locate it first.

For Windows XP users:

C:\Documents and Settings\<Windows login/user name>\Application Data\Mozilla\Firefox\Profiles\<profile folder>

For Windows Vista and Seven Users:

C:\Users\<Windows login/user name>\AppData\Roaming\Mozilla\Firefox\Profiles\<profile folder>

Note: In the above two locations you will find userChrome-example.css file, you don’t have to modify it, you need to create a new file there called userChrome.css and than have to edit it.

Or

  1. Press WIN + R and type %Appdata%
  2. Then navigate to Mozilla\Firefox\Profiles\lpg7v146.default\chrome
  3. Here create a file named “userChrome.css”

In this tutorial I will show you how you can Hide Menu items from the context menu.

In the userChrome.css file add a line like this to hide any menu item:

#id1, #id2 { display:none !important; }

replacing each of the identifiers #id1, #id2, … with one of the selectors from UserChrome.css IDs.

Example (hides the “View Background” menu item and the horizontal line after it):

#context-viewbgimage,
#context-sep-viewbgimage {
display: none !important;
}

So by using this method you can hide any menu item that you want, lets take one more example. Lets hide the Open Link in New Window menu item.

#context-openlink
{
display: none !important;
}

That’s it now restart your Firefox and the Open Link In New Windows menu item will be gone.

Reset To Default:

If something went wrong or at some stage you want to revert back all the changes than simply delete the file userChrome.css

Now move to Advanced Tweaking Firefox Tutorial

We offer complete cisco certification training, iseb certification materials and study guides for microsoft certification to help you certified on time!







Popular on Web Today

11 Responses to " Tweaking: Edit Firefox Context Menu "

  1. Ramkumar says:

    This is strange isnt it, Firefox holds up name like userChrome.css, Sir is its related to the Personas you are using, or default to everyone?
    .-= Ramkumar´s last blog ..Software to find number of RSS subscribers =-.

  2. Suhasini says:

    Hey this is really nice but needs lot of effort to do. very nice experiment and article by you.

  3. Mad Geek says:

    Thanks @All. I am glad that you all liked it

  4. AKLeeAnn says:

    Love the thought of this but cannot get it to work. I am using Windows 7 64-bit with Firefox 32-bit, but I don’t think that should be a problem. I also tried Menu_Editor add_in without it doing anything so it might be the same issue. I like being able to totally customize the browser and was quite excited about trying out your code. Any thoughts on why my right-click menu is unaffected by this code? I am sure the file is named properly and is in the right location according to your instructions, except my profile.default folder has a different unique name.

    Code used to remove back button & view background image:
    @namespace url(“http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul”);

    #back-button[disabled="true"] {display: none!important;}

    #context-viewbgimage,
    #context-sep-viewbgimage {display: none !important;}

    Thank you!

    • Mad Geek says:

      Please check are you saving this code in userChrome.css file or userChrome-example file.

      Only codes saved in userChrome.css will work.

      • AKLeeAnn says:

        I was using Frontpage to edit my text. Even though it looked like text, it must have some hidden codes in it. Once I retyped it using Notebook, your code work fine. Once I figured that out, I have spent hours looking for how to add to the context menu. There are zillions of examples for hiding and removing items.

        A simple one would be cut or paste, but I’m not sure of the syntax, simple as it might be. I am not sure how to punctuate it.
        #context-cut
        #context-paste

        But what I really want to do is add a context menu item to send a link to a specific email address. I can do it in IE with code in an html file referenced by regedit. But I am disgusted with IE and am trying to have everything I like about it available in Firefox.

        Would appreciate your insights on adding to the context menu. I might add, that Menu Editor add-in did not work at all for me, but even if it did, I did not see how to add a specific email address to send link.

        Thanks!

        • Mad Geek says:

          #context-cut, #context-paste
          {
          display: none !important;
          }

          will work fine.

          Answering your second question, there is already a menu item name “Send Link…” which did almost the same as you want.

          May be if you can look after its working than it may help you or if you can send me the code of your IE code than by looking at it I may get some idea to how to this.

  5. pokemon says:

    Great! Thanks a lot!
    btw, i cannot remove the seperator line under Select All, what is problem with that?

  6. emreka says:

    You might want to check userstyles.com (assuming you have stylish addon installed.), there are lots of context menu modifications(with this very same method). I managed to make my own, combining a few of them and I’m pretty happy about it. Also, with stylish you can see the affects immediately, you can add the codes to your userchrome.css later after testing with stylish.
    Another thing, most decent addons like flashgot, tab mix plus, imagezoom etc. have options to hide their context menu entries.Check your addon options.

Leave a comment