How to Disable Right-Click and Why It's Naive

What readers think when you disable right-click (Image via Pixabay Public Domain)
What readers think when you disable right-click (Image via Pixabay Public Domain)

Disabling right-clicking functionality on your website as a whole, or just on specific pages, is as easy as inserting a few short lines of JavaScript code in your page's source code. However, doing so marks you as naive and a rank amateur. People who visit your webpage who happen to be webmasters themselves will roll their eyes when they discover they can't copy and paste on-page. And visitors who aren't webmasters will also roll their eyes at your naive attempt to deter copiers. But why would they scoff at your valiant efforts to prevent content thieves? Because there are two incredibly easy ways to get around disabled right-click, so simple any dope can do it:

(1) View the page source code and copy the plain text directly from the code. Right-clicking can only be disabled on the browser-rendered HTML, not the raw code itself.

(2) Turn off JavaScript in your browser's settings. This stops your browser from running any active JS programming, including the one that disables right-click.

And when it comes to disabling your readers' ability to copy images, not only can they do it by finding the image source in your source code and viewing the raw image, but they can also apply a third trick:

(3) Hit the "Print Screen" button, aka take as screenshot or screen grab, and copy the results into Paint.

Before we get more into why disabling right-click is a bad idea, here is the JavaScript code for disabling right-clicking, highlighting, and copy-and-pasting. Just copy the code and insert it into the HTML code in your webpage's header.

JavaScript Code to Disable Right-Click, Text Selection, Image Copying, Highlighting, Copy and Paste

<script type="text/javascript"> 
document.oncontextmenu=new Function("return false");
document.onselectstart=new Function ("return false"); 
if (window.sidebar){
  document.onmousedown=new Function("return false"); 
  document.onclick=new Function("return true") ; 
  document.oncut=new Function("return false"); 
  document.oncopy=new Function("return false"); 
  document.onpaste=new Function("return false");

Why It's a Bad Idea to Disable Right-Click

Apart from the simplicity of circumventing disabled right-click, there are six other reasons why disabling it is bad for your website.

(1) Readers will never visit your page again if you run codes that mess with how their browser operates. This is as annoying as running pop-up ads that can't be closed.

(2) Believe it or not, most people who want to copy your text and images are not doing so for the purpose of putting the content on their own website and siphoning your traffic with a competing clone page. People copy images to save for their own files, and copy text for their own personal document needs. And for those that are using your text on their own websites, most are using only small amounts to quote you, amounts small enough to fall under fair use.

(3) Many people use right-click to print out physical copies of webpages. In fact, older people who are not as technically savvy often prefer to read from paper than from screens, and many of them do not know how to print except from the right-click context menu. Do not alienate your old fogey readers.

(4) Readers who aren't fluent in English (or whatever language your website is written in) often need to copy and paste text for translation.

(5) Almost all scraper blogs are generated by scripts that execute the scraper code from your website's code. There's no human involved, manually copying and pasting from your website as it appears in a browser. To stop scraper bots, you need to put something extra in your source code that is invisible to readers and won't disturb their experience at all. Disabling right-click does the opposite -- it has ZERO effect on bots but does bother your readers.

(6) If your readers resort to disabling JavaScript to copy or enable right-click, other JS-dependent elements of your website will not work properly. And this includes ADVERTISEMENTS. You know, the little blocks of pictures and text that make money so you can afford to keep your website up and running. Other webpage elements that may require JS to run properly include videos, forms, quizzes, polls, calculators, animated effects, and visitor tracking scripts.

Disabling right-click hinders legitimate educational uses of your webpage, and makes it difficult to translate your message into other languages. (Image via Pixabay Public Domain)
Disabling right-click hinders legitimate educational uses of your webpage, and makes it difficult to translate your message into other languages. (Image via Pixabay Public Domain)

But How Do I Stop Content Thieves and Copycats?!

You can't.

People can always find away to copy your content and display it on their own site as if they were the creator. What you can do is file a DMCA notice to get their web host to take down the infringing content. You can also get their advertising accounts cancelled. Since most advertisers prohibit publishers from displaying ads on infringing material, the copycats won't be able to make any money.

A better way to keep your images from being stolen is to watermark them with the name of your website. This is even more secure than the old-school method of laying a transparent gif or png over the image, or overlaying the image with a watermark, since again, the original unaltered image underneath is viewable via the source code.

More by this Author

Comments 4 comments

calculus-geometry profile image

calculus-geometry 22 months ago from Germany

Great points! Disabling right-click does stop the technologically unsavvy from copying parts of a webpage, but these are not the people who have the technical know-how to make money off of copied content or steal another website's traffic in the first place. Almost everyone knows the old "view source" trick.

Dagest 22 months ago

I had been debating with myself about adding the script to my site, I have a lot of recipes that are copied and pasted onto other blogs and forums. After reading your points I have decided not to disable right click, but I have found an alternative script that adds a line of citation to copy-pasted text. It says "This recipe is from [] and may not be republished without the author's permission." I know people can delete it and get around it, but hopefully it will give people pause before they steal someone else's original writing.

paxwill profile image

paxwill 22 months ago from France Author

That sounds like a much less annoying alternative than completely disabling the right-click function. You make a good point that adding a little message let's people know they can't just copy something found online and claim it as their own, even if they can erase the message from the copied text. Good luck with your recipe website.

Nell Rose profile image

Nell Rose 22 months ago from England

Great points Paxwill! I did wonder about this a while ago, but someone said not to do it so I never tried it, but I didn't know why it wouldn't work! lol! glad to know the reason, thanks!

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.

    Click to Rate This Article