Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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