Skip to content

Instantly share code, notes, and snippets.

@OkoyaUsman
Created January 28, 2018 08:47
Show Gist options
  • Save OkoyaUsman/32345bbd62294f862c52e3190ff27b85 to your computer and use it in GitHub Desktop.
Save OkoyaUsman/32345bbd62294f862c52e3190ff27b85 to your computer and use it in GitHub Desktop.
Disable Right Click In JavaScript
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Github</title>
</head>
<body>
<script language="javascript">
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
</script>
<h1>You can't copy the Github Community</h1>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment