Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am not asking this question from a web developer but from an end-user.

I am using several web sites (google drive, evernote and so on) that have context menu that activates upon a right click event. However, on my browser (Firefox), if I right click it opens my navigator context menu on top of the context menu implemented by the web developer(s) of the website. If I right click a second time, then the navigator context menu disapears, leaving space for the web app context menu.

How can I, as an end-user, disable right clicks on specific websites? And if possible, I would like to have this possibility "on-demand", ie being able to reactivate right clicks when I want to.

Is there an existing addon or a javascript tricks somewhere for this? And if not, which direction should I follow to code something like this?

share|improve this question
Have a look here, see the source code tab. – Ankit Mishra Oct 17 '12 at 12:37
Good idea to point to userscript. Did not think about this one. Thanks – mot Oct 18 '12 at 7:40
@Lamb: Wow, that script is horrible. When was it written, in the 90s? For reference: proper solution would be document.addEventListener("contextmenu", function(event) {event.preventDefault();}, false); – Wladimir Palant Oct 18 '12 at 11:10
up vote 2 down vote accepted

I am not aware of any extensions to achieve this but creating one wouldn't be hard. You could use the Add-on SDK, most easy to be used via Add-on Builder that is a web application to create SDK-based extensions. The high-level SDK modules don't give you direct access to the browser window however, you have to use the largely undocumented window-utils module for that. The following code in main.js works:

var icons = {
  "enabled": "",
  "disabled": ""

function disableContextMenu(event)

  id: "disable-context-menu",
  label: "Disable Context Menu",
  contentURL: icons.enabled,
  onClick: function(view)
    var window = require("window-utils").activeBrowserWindow;
    var menu = window.document.getElementById("contentAreaContextMenu");
    if (this.contentURL == icons.enabled)
      menu.addEventListener("popupshowing", disableContextMenu, false);
      this.contentURL = icons.disabled;
      menu.removeEventListener("popupshowing", disableContextMenu, false);
      this.contentURL = icons.enabled;

It's really as simple as that - adding this event handler to the context menu disables it, removing that event handler switches it back on. The extension also switches icons to indicate its state. That's it. Of course, if you want to keep the state per-tab then you will need a more elaborate logic. Good luck!

share|improve this answer
Thanks a lot for the tip. I did not know about the SDK. It seems great to play with! – mot Oct 18 '12 at 7:41

Go to the Content tab under Tools > Options. Click on the Advanced... button next to the Enable JavaScript checkbox. This opens the Advanced JavaScript Settings dialog box. Toggle the checkbox option Disable or replace context menus in the list presented.

share|improve this answer
You seem to have missed the "on certain websites" part of the question. – Matthias Urlichs Apr 11 '13 at 15:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .