This code is well tested in almost every browser say mozilla, IE, Chrome,.....
File Name: DisableRightClick.js
CODE:
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
alert("Sorry, Right Click is disabled!!");
return false;
}
document.oncontextmenu = mischandler;
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
alert("Sorry, Right Click is disabled!!");
return false;
}
document.oncontextmenu = mischandler;
very nice example.. but for some of the browsers javascript may not work... for this we need to use jquery.. with jquery.. this may help you.. http://aspnettutorialonline.blogspot.com/2012/05/disable-right-click-on-browser-using.html
ReplyDelete