1

I want to disable mouse middle click and right click on links. Via Javascript or PHP.

Or, change the action of middle and right click to act as a simple left click

Is that even possible?

I tried some codes I've found over the internet. like this one:

 <script type="text/javascript">
document.oncontextmenu=new Function('return false');
document.onmousedown=mainfn;
document.onclick=mainfn;
function mainfn(e){
    e=(!e) ?window.event :e;
        try{
        if (e) {
               e.returnValue = false;
                e.cancelBubble = true;
                if (e.stopPropagation) {
                    e.stopPropagation();
                }
                if (e.preventDefault) {
                    e.preventDefault();
                }
            }
        } catch (c) {alert(c); }

}

This should disable all mouse events. but still middle on links, works.

AhmadR3zA
  • 31
  • 5

0 Answers0