May 5, 2011

How to Prevent or disable copy content of your blog/site

If you want that visitor will not be able to copy your content from web page then it's easy using JavaScript.
It's not full proof way there are other alternate they can copy but it will not be easy way for them to copy content by just selecting required content, right click and click on copy.
Just add following JavaScript code to your blog templates and it will be secure that other user will not be able to copy content easily.
Just go to Blogger Dashboard.
Click on Design Tab –> then click on Page element.
Now you can see add a gadget link many places. Just click any one of them and select HTML and Javascript widget and paste following code to opened dialog box.

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

Then save the templates and check it. If it's working fine then you are done else you have made some mistake, to correct it repeat the process.

Enjoy the post. If you like my post then either left a comment or do subscribe my rss in you favourite rss feed reader to get latest update from me.



Thanks for sharing


but CTRL+A for select all content and then copy work.
how to fix this issue.

Tarun Dudhatra

Hi Gaurav,

Using key press event we can find that user has press control+A just alert the message and deselect the test. It can be done using java script.

Currently I am very busy with my project so I am not able to provide you code sample but once I will free I will write the sample code for that and let you know.


Rishis Lyrics


Post a Comment

Author Profile

Total Pageviews