Jump to content

How to avoid copy/paste of the content of the website

Recommended Posts

Site URL: https://luciedavioud.com/

Hello everyone, 

I'd like to prevent visitors to copy/paste the content of the website. I found this code below but it is affecting basic functions of the site so I removed it.  Any ideas how I could do that? 

Many thanks in advance

 

function disableselect(e) {
return false;
}

function reEnable() {
return true;
}

document.onselectstart = new Function("return false");

if (window.sidebar) {
document.onmousedown = disableselect;
document.onclick = reEnable;
}
 

  •  

function disableselect(e) {
return false;
}

function reEnable() {
return true;
}

document.onselectstart = new Function("return false");

if (window.sidebar) {
document.onmousedown = disableselect;
document.onclick = reEnable;
}

Link to comment

I am afraid that what you want is impossible. Anyone can copy content from a site, if they know how by using screenshots, snipping software or right clicking, copy and paste or using save as function. Drag and drop is another way content is used. Disabling right click may stop some folks, but will not stop them all, and other code as you found out, when you use it, may breakl something else. Images can be watermarked using post processing software, but I don't bother because I choose to just let my work be out there.  This guide will tell you more:

Prevent website content downloading

You can add code into your website header code injection to prevent right clicking but this will not stop screen shot grabbing or image drag and drop onto the desktop :

<script language=JavaScript> 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>
Edited by derricksrandomviews
Link to comment
  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.