If you want the right click option to be disabled on all pages in your blog then follow the instructions below. If not then you can just place the code in the post that you want to disable it in. Make sure if you paste it in a post you do so in Edit HTML mode.
If you feel uneasy about adding coding directly into your template you can add this code into a HTML/javascript gadget instead. But its better to add it through your template for best results because some scripts may have a bleed over effect on your Page Elements as well.
Design--> Edit HTML--> Ctrl+F--> Input </head> in the Find bar that comes up.
This should locate the </head> tag in your HTML page.
Place this code directly above the </head> tag.
<script type="text/javascript">
document.onmousedown=disable; //IE
message="Sorry no right click on this page!";
function disable(e)
{
if (e == null)
{ //IE disable
e = window.event;
if (e.button==2)
{
alert(message);
return false;
}
}
document.onclick=ffdisable; //FF
}
function ffdisable(e)
{
if (e.button==2)
{ //firefox disable
e.preventDefault();
e.stopPropagation();
alert(message);
return false;
}
}
</script>
You can change the text in red to the alert message you wish to display when someone right clicks.
document.onmousedown=disable; //IE
message="Sorry no right click on this page!";
function disable(e)
{
if (e == null)
{ //IE disable
e = window.event;
if (e.button==2)
{
alert(message);
return false;
}
}
document.onclick=ffdisable; //FF
}
function ffdisable(e)
{
if (e.button==2)
{ //firefox disable
e.preventDefault();
e.stopPropagation();
alert(message);
return false;
}
}
</script>
7 comments:
Thank youuuuuuuuuuuuuuuuuuuuuuu
so much
Thanks so much for this. I had to mess about some to find where to put in the script, but it works. I even customized it! look and see, http://robins-chaos.blogspot.com
Hi I tried to find this but could not locate the head tag? would it be because of the template I use? kriznizzel/blogspot.com/
Thanks
thank for your sharing
curry on friend...:)
thanks...great job...
unfortunately this did not work for me when I tested it :(
You might have JavaScript disabled on your browser or your browser does not support it.
Post a Comment
Please don't post hyperlinked text within the comment box! It will not be published and you will be marked as spam.