Friday, January 31, 2014

Disable right click without using JavaScripts

By Sonu Kumar Gupta   Posted at  3:38 AM   blogger No comments

Disabling right click on websites and blogs are very popular nowadays just to ensure that no one can copy content from their website.

Using JavaScripts provided by many websites on blog or website to protect content from being copied is very popular. JavaScripts can be of different types depending on it's author, they can put whatever they want and block right click on webpages.
But JavaScripts have it's own bad effect on blogs, because most the JavaScripts provided to disable right click on webpages sends out an alert message whenever someone right clicks and it is irritating. And JavaScripts can be easily bypassed and allow the right click.
So what you want is a hassle free way to stop peoples from right clicking on your page and copy your contents.

One benefit of having right click disabled is that you can stop most visitor from copying your contents, but there can be some people knowing ways to bypass it, but hope you don't have such visitors who will copy your content.

The real trick

Almost everywhere you will see tricks to disable right click using JavaScript, but if the user disables JavaScript they can easily use right click on your website without any difficulties. JavaScript is not an ideal way to do it.
We have got a new way to disable right click without any implementation of JavaScripts that can slow down your page. I came to knew about this while I was in a net banking site, just used the chrome developer tool tools to inspect what they used to disable right click and found it.
It was a small attribute in the body tag of the document. So follow the steps to do it on Blogger, this can implemented on any website, just find your main HTML and add this attribute in the <body> tag.

  For Demo you can right click on the website.

For Blogger Users - 

  1. Go to Blogger Dashboard
  2. Select Template tab
  3. Click on Edit HTML > Proceed
Now click CTRL+F and find enter this <body into the search box, you will find something similar to this




The
<body> tag is just below the ending </head> tag. Now when you find it, copy this small code snippet or a short code word.

1
oncontextmenu="return false;"

When copied, go back to the Edit HTML of your Blog and paste this after
<body with a space in between. So it must look something like this


Once you have added the attribute in the body tag refresh your blog with CTRL+F5 and try to right click, now you have right click disabled on your blog/website ! Great, people can't copy your content.

Negative points in using JavaScript for this ?

You can rank JavaScript 2nd to play the trick of disabling right click on a website but there are some negative points of JavaScript. Read those below
  • Most JavaScripts uses alert message which can annoy regular users
  • If the page load is interrupted when the page is loading then JavaScript don't work which will result in letting others copy your contents with right click.
  • Those who want to copy the content they can disable JavaScript in their browser and they can copy the content again. 
  • JavaScript slows down the page loading speed .
So, these were some negative points of using JavaScript to disable right click, simply use the small attribute to make it work like the JavaScript does.

Will it completely disallow the user to copy contents ?

You must accept the bitter truth that there's no technique which can keep everyone from copying contents or pictures from a site. They can use many ways to do this, but if you don't have some wicked minded people on your blog then it's guaranteed that your content will be less copied from your site. Using this trick is better than not using it.

Your feedback

As always your opinions and feedback is important for us because you are the one who makes our post more valuable and worth reading. Drop your comments to express your thought on this tutorial.
Share this article with your friends.

About the Author

SONU is a young addicted Blogger who is founder of the site. He is 18 years old and living in Bihar,India. Currently, He is Preparing for JEE and running his site. He loves to share his Blogger resources, Latest software development and helping newbies in the Blogging world..

0 comments:

Comment Policy : We do receive a lot of comments each day and those comments are moderated by the human being not automated robots. So, Please avoid doing spam and posting links in comments otherwise comment will not be published. We can't tolerate anymore. Thanks for understanding!

Back to top ↑

Connect with Us

© 2014 . Sonukumar Converted by Sonukumar