Designer BlogsHomeThe TeamEmail UsThe Blog

Friday, July 2, 2010

How To Right Click Disable Your Blog

Do you want to protect the images and photos on your blog? You can protect your site with a right click disable code! Using the follow code will cause an alert box to pop up with the message of you choice, letting people know that your information is copyrighted. The code isn't foolproof, but it does allow you to warn people who want to take your graphic and photos.

Please note: If you have a blog button on your site with the HTML share code, be sure to let your readers know to use their keyboard short cuts (CTRL C, CTRL V) instead of their mouse to copy your button code.

Copy the following code and paste it into a gadget box on your sidebar.



<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="Please do not use any images from this site without written permission. info@designerblogs.com";

///////////////////////////////////
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>





If you'd like a different message to pop up, change the phrase in red, but DO NOT delete the quotation marks around the message.

That's it! Now your information is right click disabled!

13 comments:

  1. Thank you! Thank you! Thank you! I've been trying to find a way to protect images of my kids and clients, and I'll now sleep better at night knowing my photos are protected.

    ReplyDelete
  2. Is there any way to make this apply to only the pictures and not the posts themselves?

    ReplyDelete
  3. @phasejumper: Not that we are aware of. But we'll be sure to post about it if we ever find a code that applies to just pictures!

    ReplyDelete
  4. I was hopeful when I saw this but I can't get it to work. Copied it all, put in my email address in place of yours. Left the quotation marks intact and saved it in an html gadget.
    No luck???? You can still right click and copy the photos. Had my son try it from his computer too but it isn't working.
    Any ideas?

    ReplyDelete
  5. Hi Lori! Something in the code must've been left out during the copy to the HTML gadget. We use this code on all of our premade designs and on some of our personal blogs. The code is NOT foolproof -- unfortunately there are ways around it. Luckily for all of us, I think one of the DB girls has a new tutorial for a better disable code that I'm sure will be up sooon!! So keep your eye out for it. :)

    ReplyDelete
  6. I just tried it on my genealogy blog and it works great???
    I wonder what is wrong on my main blog that stops it from working.
    At least it works on one. Thanks

    ReplyDelete
  7. Oh my gosh....i can't say thank you enough for this tutorial. I'm so thrilled about this! I love to blog and love to take photos, but often worry about them being lifted. Yeah, i worry about a LOT of things, lol...

    Seriously, thank you!!

    ReplyDelete
  8. I loved this! Until I get my blog button this will do just fine! Yeah...thank you, DB!

    ReplyDelete
  9. I've try it.success!!!!!!!! tq so much...

    ReplyDelete