Created
December 18, 2011 01:57
-
-
Save alphaville/1492097 to your computer and use it in GitHub Desktop.
Prohibit Right Clicks on your page using JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script language="javascript"> | |
function click(e) { | |
if (navigator.appName == 'Netscape' && e.which == 3) { | |
alert("no right click please") | |
return false; | |
} | |
else { | |
if (navigator.appName == 'Microsoft Internet Explorer' | |
&& event.button==2) | |
alert("no right click please") | |
return false; | |
} | |
return true; | |
} | |
document.onmousedown=click | |
</script> | |
</head> | |
<html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment