October 14, 2010

How to avoid copying of Data from website or Blog using javascript.

HTML,Javascript ,Blog,Blogging tricks.
Well we all face problem of some or other copy cats lurking around to copy data from our blog or website.
It is hard written work, We take our valuable time and write content.
But someone visits your blog and just copies your materials and goes of with data.
And sometimes end up getting higher page views than yours and getting better reviews.
I have seen many of my friends getting frustrated when petty thief copies data from their site and pastes word to word on his/her site.

So I decided to write this article to help my those friends, who face this problem.

Here is the code

<script type="text/javascript">
var omitformtags=["input", "textarea", "select"]
omitformtags=omitformtags.join("|")
function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}
function reEnable(){
return true
}
if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
</script>

Now how to configure it?

Just head to your blog.
Open its source code that  is HTML file.
Take a backup of HTML file and save it on your computer.
In case you go somewhere wrong.
Now Copy the above code and paste it before

 </body> tag. Thats it you are Done now save your file/HTML file.
Now upload that file to blog.Its done.
If you get any problem feel free to contact me.   

5 comments:

Doug Stephens said...

But what does this actually accomplish? What happens when someone tries to copy?

Alynne Leigh said...

I like the idea of protecting your work, but how does this do that?

sanketkingkong said...

@Alynne This Javascript Code disables the selecting of Content of Blog post or website and hence a user is unable to
to Copy.

sanketkingkong said...

@Doug This is necessary to protect one hardwork as a blogger because many people just copy paste content from others blog...

and steal the hard work

Cynthia L said...

This is really useful. Thank you

Cynthia
PDR