Pages

18 September 2011

How to Disable Right-Click on Your Blog or On A Particular Page

Blog readers are essential for good traffic on any blog. However, not everyone who visit your blog comes with good intentions. Just like some loyal readers come to read your content, each time you update, others simply come to copy your 'sweat and hardwork', and paste onto their blogs. This can be quite annoying!

So for several reasons ranging from what i referred to above, to protection of images or that of source code and many other reasons, a blogger may decide to disable ability of site visitors to right-click on their blog.

To disable the ability for your readers to right-click on your blog, you will have to paste a few lines of JavaScript into your blog. Do also note that aside disabling right-clicking across your blog, you may also want to set disability to right-click on particular pages.

How To Disable Right-Click on Your Blog or On A Particular Page

METHOD 1: Inserting via the Blog Template

  1. Log into your Blogger dashboard. From here, select and click Template > Edit HTML > Proceed

  2. Search for this code in the template:
    </head>

  3. Paste the code below just before the </head> in your template:

    <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'/>
    <script type='text/javascript'>
    //<![CDATA[
    $(document).ready(function(){
    $(document).bind("contextmenu",function(e){
    return false;
    });
    });
    //]]>
    </script>

  4. Save Your template

METHOD 2: Inserting via the 'HTML/Javascript' Gadget

I also accidentally discovered this method of implementing the code. Although I blog using the Blogger.com platform, I believe this will also work for any other blogging platform. This method is especially better for bloggers who are not so techie:
  1. Login into your Blogger dashboard, and click on 'Layout'
  2. In Layout, click on the 'Add a Gadget' link. When it comes up, scroll down and select /click on 'HTML/Javascript'. When this opens up, copy the code above and apply onto the blank interface.
  3. Click 'Save', and position it wherever you want (i positioned mine below Blog Posts). And you are done!
So, if you fall into that category of bloggers who are not so technically inclined, you may simply apply the second method above.

Congrats! No-one would right-click on your blog from now henceforth.

NOTE: Both the first and the second methods will work. I believe this code will also work in a non-blogger template. I really hope it does on other platforms. On Blogger, it does work!

No comments:

Post a Comment