[Get]Script To Copy Protect Your Content

Nitecruzex

Newbie
Joined
Jun 9, 2011
Messages
30
Reaction score
6
Copy the script in the head section. Please note that if you are putting up links in code form, your audience will have to type it word by word. They can't copy the link.

Script:

Code:
<script language='JavaScript1.2'>

function disableselect(e){
return false
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function ("return false")

//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</script>
 
Disable run JavaScript from the browser settings and goto the site and this becomes useless :)
 
It doesnot disables right click. It disables the "onmousedrag" event so you can't select anything.
 
Disable run JavaScript from the browser settings and goto the site and this becomes useless :)

Of course you can do that. Best of all, view source code and copy the content. But this helps. Sahi bola na sahil ;)
 
yup, most of the users still know how to view the page source and copy from there. But it is still able to make some protection for those who don't know about page source thing.
 
I think you still can copy the articles from the source code :D
 
Use jQuery for stuff like this instead, to ensure cross-browser compatibility.

Code:
jQuery.fn.extend({ 
        disableSelection : function() { 
                return this.each(function() { 
                        this.onselectstart = function() { return false; }; 
                        this.unselectable = "on"; 
                        jQuery(this).css('user-select', 'none'); 
                        jQuery(this).css('-o-user-select', 'none'); 
                        jQuery(this).css('-moz-user-select', 'none'); 
                        jQuery(this).css('-khtml-user-select', 'none'); 
                        jQuery(this).css('-webkit-user-select', 'none'); 
                }); 
        } 
});

To disable selection of text in a div with id tehDiv:

Code:
$('#tehDiv').disableSelection();
 
Users could always copy from the source. You can't really prevent the more experienced user from getting to your content if he really wants it.

You could generate an image with your text (PHP GD2 could do this), but it's a tradeoff - it will take longer to load your page and so on.
 
Back
Top