HACKER Q&A
📣 saimiam

How to disable right-click blocking in the browser


My bank’s website has this maddening “security” feature which prevents me from copy/pasting things like account numbers and avoid fat finger errors.

I would love this block to go die in a server fire.


  👤 susam Accepted Answer ✓
I use Firefox and on Firefox this can be done by typing "about:config" (without the quotes) in the address bar, then searching for "dom.event.contextmenu.enabled" (without the quotes) and then double-clicking on the result to toggle its value from "true" to "false".

👤 genezeta
I use a bookmarklet. It can be something basic, such as:

    javascript:void(document.oncontextmenu=document.onMouseDown=()=>true)
...which works for, maybe, 60% of cases. Or you can try a more sophisticated one for greater success. e.g.:

    javascript:(function(w){
        var arr = ['contextmenu','copy','cut','paste'];
        for(var i = 0, x; x = arr[i]; i++){
            if(w['on' + x])w['on' + x] = null;
            w.addEventListener(x, function(e){e.stopPropagation()}, true);
        };
        for(var j = 0, f; f = w.frames[j]; j++){try{arguments.callee(f)}catch(e){}}})(window);
Unfortunately, these don't work on 100% of the pages. Otherwise, as someone else has suggested, Firefox allows you to disable context menu hijacking for every site.

👤 nomilk
Related: I'd LOVE to know how to force standard ctrl + f behaviour on sites that override it.

Same for sites that override ctrl + left click (to open link in new tab - some sites will treat it like you simply clicked the link and open it in the same tab - super annoying).


👤 lapcat
[self-promotion] My extension StopTheMadness stops this (supports all web browsers on macOS): https://underpassapp.com/StopTheMadness/

👤 9woc
Using Firefox, Shift-Right click shows the context menu. After that you can do your usual inspect etc.

👤 vinni2
Is there even proven benefits of blocking right click security wise? I wonder what is the rationale behind these decisions?

👤 gwnywg
Add 'tamper monkey' extension to your browser and look through the source what class to remove from elements you are interested about.

Above comes with disclaimer, I personally don't allow any extensions in browser I use for banking. A little bit paranoid but I prefer to reduce plain of attack when accessing my bank (of course there are other threats that may bring more severe risk, remove them one at a time :) ).


👤 Overtonwindow
I use a great Google Chrome extension called Allow Right Click that defeats that. Preventing right click is almost as asinine as preventing copying.

👤 abrioy
In Firefox, holding shift while right clicking works most of the time. It display the default context menu regardless of the website.

For ins.tance you can shift right click a video to use picture in picture on Youtube


👤 jrockway
I always used xdotool to get around "you can't paste here". I may not be able to paste, but you didn't check the attestation signature on my keyboard!!!

👤 nokya
You can't.

You can try, but you can't. The only people you'll stop are non-tech users, and the others will shame your business for playing this game.

If you need an analogy, think of it as trying to disable screenshots in an environment where users carry a camera in the other hand...


👤 zaza5761
Ctrl + Shift + Right click force it to work in almost 99% of the time against right-click blockers in Firefox.

Don't have an exemple of when it would have failed :-)


👤 throwway1
window.addEventListener("contextmenu",function(e) { e.preventDefault(); //e.stopPropagation(); },false);

👤 sawmurai
I remember when you could right click and hit enter at the same Time to still get a context menu

👤 nextstepguy
Absolute Enable Right Click & Copy Chrome extension.

👤 Jemm
uBlock Origin adds a Block Element menu to the context menu.