We can disable right click on apage using the following code
<script type="text/javascript">
document.onmousedown = clickfn;
function clickfn(e) {
var button;
if (navigator.appName == "Microsoft Internet Explorer") {
button = event.button;
}
else {
button = e.buttons;
}
if (button == 2) {
alert("Right Click Disabled");
if (navigator.appName == "Microsoft Internet Explorer") {
event.returnValue = false;
}
return false;
}
}
</script>
navigator.appName == "Microsoft Internet Explorer" this is used because in ie 7 "e" is not supported so we used event in common for all ie versions...
<script type="text/javascript">
document.onmousedown = clickfn;
function clickfn(e) {
var button;
if (navigator.appName == "Microsoft Internet Explorer") {
button = event.button;
}
else {
button = e.buttons;
}
if (button == 2) {
alert("Right Click Disabled");
if (navigator.appName == "Microsoft Internet Explorer") {
event.returnValue = false;
}
return false;
}
}
</script>
navigator.appName == "Microsoft Internet Explorer" this is used because in ie 7 "e" is not supported so we used event in common for all ie versions...
nice share gan, sekedar tambahan untuk chrome perlu ngehandle even document.oncontextmenu juga, klo ndak gitu menu klik kanan nya masih keluar..
ReplyDeletebagaimana cara handle document.oncontextmenu nya..?
Deleteboleh minta contoh codes nya..?
how to disable second dialog box i.e "prevent this page from creating additional dialogs"??
ReplyDeleteplease tell as soon as possible??it is urgent..
ReplyDeletethank you very much.. just copy paste working fine
ReplyDeleteHello Bro., Sorry to say that I can right click on your web page at scroll bar and can hack source code...
ReplyDeleteBy pressing F12 key any one can go to source code.
ReplyDelete