Have you noticed, that some web sites do not allow their visitors using right mouse click while pointer is on the blog area. This option is useful for the site and blog owners, who want to minimize the possibilities of the content direct copying to other posts.
Provided cross browser DHTML script from dynamicdrive will help you achieving the same result on your own blog, preventing default right menu from popping up when right mouse is clicked. There are actually two options for this script are provided: Alert Option and Non-alert Option. If the Alert Script is enabled, if someone tries to execute Right click on the blog, then a Message, which can be customized per your desire, appears. If the Non-alert script is activated, then no message is displayed.
To setup this tool in your blog Copy the Following code and paste it to your blog by adding a new page element.
Message Alert Script:
<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>
Message Non-Alert Script:
<script language=JavaScript>
<!--
//Disable right click script III- By Renigade (renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com
var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// -->
</script>
thanx It's all r perfectly working
ReplyDeleteThank u so much
Thank you for nice feedback!
ReplyDeleteThank you very, very much! I really appreciate you posting this code for others.
ReplyDeleteI've been having a problem with a multitude of users copying my Blog content and posting it on their own site as there own with no credit of were it came from.
Hi John,
ReplyDeleteThank you for your warm words. I agree that there is quite frequent nowdays when the authors content is reposted with no respect and reference to the original poster.
thank you so much!
ReplyDeletefinally i can post my pics without worrying others taking'em :)
Allenisya,
ReplyDeleteNote that disabling right click will just disable right click. You can still use keyboard for the image selection.
Hi Michael
ReplyDeleteThank you very much for this tutorial, it works perfect on my blog.
If you like hand made things visit my blog:
http://hechoamano-handmade.blogspot.com/
Cheers and God bless
Nuria from Spain
Thanks so much!
ReplyDeleteI can finally post my story up here =)
THANKS again!
flyre.blogspot.com
Thanks! Your article is really very helpful for bloggers. It feels very bad when someone steals your hard work within few mouse clicks. Thanks again and keep up the good work.
ReplyDelete