jqueryexample.com jquery - disable right click - jqueryexample.com

jquery – disable right click by jqueryuser

Disable the mouse right click as often used with websites who want to add some low level security. To Solve the purpose we just need to bind the contextmenu event.

        return false;

Disable right click using javascript:

<script type=”text/javascript”>
var isNS = (navigator.appName == “Netscape”) ? 1 : 0;
if(navigator.appName == “Netscape”) document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
return false;
function mousehandler(e){
var myevent = (isNS) ? e : event;
var eventbutton = (isNS) ? myevent.which : myevent.button;
if((eventbutton==2)||(eventbutton==3)) return false;
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;

Did you like this? Share it:


No comments yet, be the first.

Leave a Comment