May 27, 2015

Disable Copy Function in Blogger With CSS/JavaScript

data:blog.title
You have seen many of bloggers disable copy function on their blog. It is because most of Genuine bloggers who works a lot for their blogs and write content for their blog always face the problem of being content copied by the newbies who are just entering to the Blogosphere with the goal of making money without the making real efforts and understanding the value of real content and things who like readers.

How To Disable Copy Paste in Blogger?


Sometime the copied content by them get higher ranking by the search bots compare to your original content. So, it is important to protect your blog content from these type of foolish newbies (Content thieves) who never understand the value of our efforts and real work.

The agenda of this post is How To Protect Blog Content from Being Copied? Actually, We make it possible by disable the mouse right click on our blog page and also disable the CTRL+A.

We have two options for make it possible First by JavaScript (If you want to Disable Whole Text Area.) and second is by CSS Coding (If you want to share some Codes/Text of your page for allow your readers to copy them). Now option is yours, Via JavaScript or Via CSS. Follow below instruction and follow the option which you want to use on your blog.

How To Disable Copy Function Via JavaScript?

  • Go To Blogger >> Template >> Edit HTML.
  • Now search for <head> tag and paste below JavaScript code just after of <head> tag. You can search by pressing CTRL+F or CMD+F.
<!--Disabe Copy Paste by MBG-->
<script language='JavaScript1.2'>
function disableselect(e){
return false
}
function reEnable(){
return true
}
document.onselectstart=new Function (&quot;return false&quot;)
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</script>

  • Now, Save your Template.
  • Open your blog and check the result.

Disable Copy Function Except Specific Codes/Text with CSS.


This is the magic code which is using on our blog, because we are sharing guides where readers need to copy some codes like CSS, HTML, JavaScript, etc and same time we don't allow our readers to copy other text area of blog post except specific CODES/Text which we have allowed to copy. This is possible with little CSS Coding.

Now, If you want to use this magic code on your blog the read below instruction and follow all steps carefully.

  • Go to Blogger >> Template >> Edit HTML.
  • Now, Copy and paste below code just above of ]]></b:skin> tag inside your Template Code.
/*----- Disable Text Selection with CSS Code by MBG----*/
.post blockquote {
-webkit-user-select: text !important;
-moz-user-select: text !important;
-ms-user-select: text !important;
user-select: text !important;
}
body {
-webkit-user-select: none !important;
-moz-user-select: -moz-none !important;
-ms-user-select: none !important;
user-select: none !important;
}

Important: In the above CSS code we have enabled the copy/selection of text/code we post using blockquotes by enabling .post blockquote but it may not work for you if your template is using different CSS class for blockquote for e.g., Our template using .blockquote where your template may be using .post-body blockquote. So in that case you need to replace .post blockquote with .post-body blockquote or blockquote in above CSS code.  If you do not share any codes or content than just copy paste this little piece of CSS code to disable all text area on your blog

/*----- Disable Text Selection with CSS Code by MBG----*/
body {
-webkit-user-select: none !important;
-moz-user-select: -moz-none !important;
-ms-user-select: none !important;
user-select: none !important;
}

Benefits of using CSS rather than JavaCript?

  1. The JavaScript Code slow down Blog loading speed which can effect our rank in search engines and CSS Codes do not lower the speed of your Blog/Website.
  2. When we use JavaScript for this function, Do you know what does a copy cat do? Simply disable the JavaScript inside browsers and reload the page. Then our JavaScript code does not working and a copy cat can simply select the text and copy it and in other side when we use CSS Coding there is no option to stop CSS coding to load. Some excerpt users can do this but expert users rarely do that.

 Conclusion: 

So above guide is about How To Disable Text Selection of Blogger Posts? We hope by this tutorial you can do it easily. If anyhow problem persist after following all above steps then drop a comment below. We will help you out of sure. Do Share.
Thank You! Stay Blessed!

1 comment:

  1. This is the perfect website for anybody who hopes to understand this topic.
    You know a whole lot its almost hard to argue with you (not that I personally would want to…HaHa).
    You definitely put a new spin on a subject that has been written about for decades.
    Excellent stuff, just great!

    Feel free to surf to my homepage; comprar goji berry capsulas

    ReplyDelete

We’re eager to see your comment. If you have any query related to the topic then drop a comment below. We will help you out of sure. However, Please Keep in mind that all comments are moderated manually by our human reviewers. According to our comment policy all link are nofollow so keep in mind that never use links in comments, we consider link comments as a spam.