Tuesday, July 19, 2011

blogger tips -Prevent or disable copy contents of your blog or site

If you want to prevent users from copying contents of your blog or site than you need to put this code in ur blog so that user can not copy ur blog's contents , i was browsing through ashish's blog and got this script

Go to Layout and click on add new gadget > select Html/Javacsript

Now in the box copy and paste the following 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>


Click on save and check whether u r able to copy or not .

3 comments: