x

photos

How do I protect my photos from being copied?

839 Views
Message 1 of 2
Report
1 REPLY 1

@vfumc 

If someone really wants to get your images they'll be able to do so via screenshot or hotlinking. Hotlinking can't be prevented on Weebly because there is no access to .htaccess file. But here are three pieces of code that can help deter image theft. Add them to the header section of your website.

The first prevents use of right click but works only when clicked on images, not on text:

document.oncontextmenu = function(e){
var target = (typeof e !="undefined")? e.target: event.srcElement
if (target.tagName == "IMG" || (target.tagName == 'A' && target.firstChild.tagName == 'IMG'))
return false}

The second is a little stronger, it prevents right click anywhere on the website and if someone does right click they'll get a popup with your copyright message on it:

<script language=JavaScript> var message="ADD YOUR COPYRIGHT 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>

This third one prevents pinning to Pinterest:

<meta name = "pinterest" content = "nopin" description = "ADD YOUR COPYRIGHT MESSAGE HERE" />

Hope this helps, Gary

833 Views
Message 3 of 2
Report