Hack Forums
(code) Disable Right Click - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5)
+---- Thread: (code) Disable Right Click (/showthread.php?tid=268964)



(code) Disable Right Click - djfshady - Feb 12, 2010

here is a java code i made along time ago and recently found it while cleaning out my computer hard drive it will help prevent copying things from your website but you can still use Ctrl + C to copy things
Code
<script language="JavaScript">
function right(e) {
if (navigator.appName == 'Netscape' &&
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2 || event.button == 3)) {
alert("Please don't steal my stuff!!!");
return false;
}
return true;
}
document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;
</script>



* - Fizzix - Feb 13, 2010

Wrong section...

This section is for Java, not JavaScript.

Also, it doesn't stop people from going to file -> view source or what ever via their browser.


* - djfshady - Feb 13, 2010

i know and oops i didnt notice sorry thought i posted it in the right section


* - Zn4k3 - Apr 27, 2010

Who cares.............. thank you :D


* - djfshady - Apr 27, 2010

lol your welcome zn4k3