Portal of all Blogger widget, Airtel USSD Codes, Facebook Hack, Free Internet Tips, PC and Blogger Tricks

Breaking

Sunday 28 July 2013

Disabling text selection in Blogger| Prevent User From Copying Your Content

How To Disable Text selection in Blogger

Here we have come with two different methods of disabling text selection in blogger.

You May Searching For:


First Method
To disable Text selection in blogger,simply follow the below given steps:
  • .Log into your blogger Account .
  • Click on “Layout” option.
  • After that click on “Add a Gadget” option.
  • Select HTML/JavaScript option.
  • Now enter the following code in the body part.
CODE:
<script type="text/javascript">//form tags to omit in NS6+: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=disableselectdocument.onmouseup=reEnable}</script>

6.Save, you are done.

Second Method

This tutorial is useful for those of you who want to protect your blog article from copy and paste.
  • Open your template
  • Find </head> tag and put this code above it :
CODE:
< script type = 'text/javascript' >
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"}
< / script>
  • Now Find <body> tag and replace <body> with this code :
CODE:
< body oncontextmenu= 'return false;' >
< script type = 'text/javascript' >
disableSelection(document.body);
< / script>
I Hope you have done successfully.If any problem please mention it in comment box.

1 comment:

  1. I have used first method and it is ewxcellent....Nice Disable Text selection article..

    ReplyDelete

Notice: Don't add "backlink". Text with Link will automatically Removed.