Saturday 8 June 2013

How to disable right-click

Many bloggers use this code to prevent other users from copying from their sites.

1. Log onto Blogger and go to Layout
2. Then go to Add a Gadget > HTML/JavaScript
3. Copy the following code:

<script language=javascript>
<!--

var message="Add your popup message here!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// -->
</script>

4. Now, paste it and save it. No more right click!
5. Change "Add your popup message here!" to whatever you want the alert message to say. Be careful... don't delete the quotes or else; it won't work.

Until next time,
Bunny623

No comments:

Post a Comment

Welcome to the comment section (I guess :P) Don' be inappropriate and mean! Or else... WE WILL FIND YOU.