Got a minute to answer a question?

When building a website, which is the most important?
Price.
Visual Design.
The ability to edit the site yourself.
The attitude / friendliness of the designer.
View Result
Open Widget Area

How to protect your website content

GD Star Rating
loading...

This little tutorial covers how to prevent people from using simple techniques to steal your website text and images – please note that this is by no way a bulletproof way of protecting your website content, there are ways around this system but it will stop the casual copy ‘n paste visitor…

You will need FTP access to your website and you will need to be comfortable editing files (either .html or .php etc)

The first step is to disable “right click” as this is the most common way to grab images from a webpage:

You will need to edit each page that you want to protect if your website is HTML based or if you are running a script such as a Blog or a CMS system then you should be able to get away with just editing either the index.php file or the main template file(s)

The following code needs placing at the top of the <BODY> tag of the page you want to protect:

 

<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>
<script language=JavaScript>
<!–
//Disable right mouse click Script
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>
The “Function Disabled” text  can be changed to any error message that you would like to appear when a visitor right-clicks on your webpage.
Next we need to disable the ability to highlight text on a page, this is because although we have disabled the ability to right-click a visitor can still highlight and <CTRL> + C to copy text!
The following code needs to be placed in the <HEAD> section of your webpage:

 

<script type=”text/javascript”>
/***********************************************
* Disable Text Selection script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
function disableSelection(target){
if (typeof target.onselectstart!=”undefined”) //IE route
target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!=”undefined”) //Firefox route
target.style.MozUserSelect=”none”
else //All other route (ie: Opera)
target.onmousedown=function(){return false}
target.style.cursor = “default”
}
//Sample usages
//disableSelection(document.body) //Disable text selection on entire body
//disableSelection(document.getElementById(“mydiv”)) //Disable text selection on element with id=”mydiv”
</script>
Once this code is in place in the <HEAD> of your web page(s) you will need to add the following snippet of code to the bottom of every page you want to protect:

 

<script type=”text/javascript”>
disableSelection(document.body) //disable text selection on entire body of page
</script>
There you go… Visitors can no longer highlight your content to copy or right-click your content to copy ‘n paste it.
With just one click you can share this page...
Facebook Twitter Linkedin Digg Stumbleupon

Like ! Share with friends on the following networks

We are currently updating our website so please excuse us if some of the pages are not currently working - we are working hard to get everything spot on!

Menu