How to Disable Select Text & Right Click Function on Blogger

Discussion in 'Blogging' started by Bravozone, Apr 9, 2013.

  1. #1
    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 :
    <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>
    HTML:
    > Find <body> tag and change with this code :
    <body oncontextmenu='return false;'>
    <script type='text/javascript'>
    disableSelection(document.body);
    </script>
    HTML:
    > Save your template
    > Done, check the result.
     
    Bravozone, Apr 9, 2013 IP
  2. ninjamtlt1

    ninjamtlt1 Active Member

    Messages:
    1,704
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    88
    #2
    I never thought of this, but great advice, thanks for sharing. Could help stop the spammers and copycats.
     
    ninjamtlt1, Apr 10, 2013 IP
  3. dafuqjoe

    dafuqjoe Member

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    JS is the only way to do that. But remember: there are lots of people who have disabled JS.
     
    dafuqjoe, Apr 10, 2013 IP
  4. Dani Lad

    Dani Lad Member

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #4
    How Can I disable text selection on selected posts in Blogger?
     
    Dani Lad, Apr 21, 2013 IP