If you're posting a piece of writing or a particular photograph onto your Blogspot blog, and you don't want people to copy it, you can use a Javascript code to prevent users from right-clicking. However, you should know that this will only prevent users who have Javascript turned on from right-clicking -- more advanced users will simply be able to bypass this protection. Unfortunately, besides the Javascript code, there isn't anyway to prevent someone from right-clicking.
- Go to Blogger.com and log in to your blog.
- Go to your "Blogger Dashboard," then click "Layout".
- Click "Add Gadget."
- Click "HTML/Javascript."
- Copy and paste the following code:
<script language=JavaScript>
<!--
//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com
var message="Function Disabled!";
///////////////////////////////////
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>
- Click "Save." When you try and right click anywhere on your blog you will see a message that reads "Function Disabled."
You can change the words "Function Disabled" to anything you want by changing the words in the code.
0 comments :
Post a Comment