Skip to content

Instantly share code, notes, and snippets.

@pbaruns
Last active April 27, 2020 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbaruns/a84a679fbb7f7cd99ac93684c9de4afa to your computer and use it in GitHub Desktop.
Save pbaruns/a84a679fbb7f7cd99ac93684c9de4afa to your computer and use it in GitHub Desktop.
Blogger - disable right click menu option
//disable right click menu
<script language=javascript>
function blockOne() {
if (document.all) {
return false;
}
}
function blockTwo(e) {
if (document.layers||(document.getElementById&&!document.all))
{
if (e.which==2||e.which==3) {
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.mousedown);
document.onmousedown=blockTwo;
}
else {
document.onmouseup=blockTwo;
document.oncontextmenu=blockOne;
}
document.oncontextmenu=new Function("return false");
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment