Don't Disable Right Click!

After working hard on a design, image or article you may want to protect it by using a JavaScript that disables right-click while optionally warning a visitor that the content is copyrighted.

It might sound ok, but this isn’t generally a good idea. Why not?

It’s annoying!

You don’t realise just how much you use right-click until you can’t use it! There are a lot of useful features in the short menu that it opens up. While most are also available in the main browser menu, it’s often much quicker to use the right-click menu — this is usually the closest menu you have available.

It’s pointless!

If you think disabling right-click will protect your source code or images, think again! Anyone who’s determined to copy your content or code will do so regardless of his or her ability to bring up a browser context menu. If they want your source code then it’s as simple as selecting ‘view source’ from the main menu. Article text can be highlighted and copied, images and media presentations can be retrieved from the cache, and streaming media can be recorded.

Disabling right-click will only make people more determined to learn exactly what it is you’re hiding. And this could end up being counter-productive, as your images and source code attract unwanted attention. Not only that, but you can only disable right-click on browsers that have JavaScript enabled: a visitor only has to turn off JavaScript in their browser’s options to be able to ignore the script altogether!

It’s disabling!

Mouse gestures that enable quicker navigation are starting to become a feature of browsers: Opera has them, Mozilla has just added support, and it’s only a matter of time before Internet Explorer adopts them. Disabling right-click on pages viewed in these browsers also disables the ability to use mouse gestures, so you won’t be popular with those that use them frequently!

Even when you don’t make use of mouse gestures, their absence can still seriously affect your ability to browse the Internet. I tend to open any links from a page I like in a new window from the right-click menu, so that I can read and compare both pages and return without having to use the back button. While you can open a link in a new window by holding down shift while clicking on it, many find it easier to use the option from the right-click menu. Disable right-click and you’ll alienate these users pretty quickly.

It’s unprofessional!

Ask yourself this: would you buy something from a site that reminds you its images are protected by copyright every time you go to use right-click (even when your pointer is nowhere near an image)? I thought not! Disabling right click suggests a lack of professionalism to users.

It’s insulting!

Most of your visitors will come to your site looking to buy something, or to find information. Only a small percentage of your visitors will land at your site with the intention to steal from it. By trying to protect yourself from the minority, you effectively insult the majority, who will use the right-click menu for legitimate reasons. Do you really expect your visitors to trust you when you offer them "helpful reminders" that imply you can’t trust them?

Granted, some people will want to view your source code — but don’t assume that everyone who looks at it will want to use it on their site! Savvy visitors that are aware of deceptive techniques used by some unscrupulous site owners may just want to check that a link is going to take them where they think it will take them. Does that make them a thief?

Solutions for Content Protection

There are other, less controversial alternative solutions available to the problem protecting your images or source code.

Protecting your Images

1. Disable Right Click on Images only

If you really must disable right-click, then limit the aggravation and use a script that disables it on images only (some scripts also prevent the IE6 image toolbar from appearing). Of course there will be times when people want to use right-click and have their mouse over an image, so I’d recommend you change the message slightly to reflect the fact that only images are affected.

2. Mark Images

Another way you can identify images as your own is to mark them in some way. The best way to deter the would-be thief is to make a visual mark on the most interesting part of the image. Marks such as your logo, your site address or even the word "sample" in either a solid or translucent colour make it obvious that an image is not intended for general distribution. This graffiti-style tactic works well on sites that offer artistic services, and can also help to discourage hotlinking.

3. Digital Watermarks

Digital watermarking is the practice of embedding identifiable information into a file. Typically this is a unique ID code or the image creator’s contact details. This embedded information is invisible to the average surfer but can be viewed with the aid of graphic program plug-ins or specialist stand-alone decoders. A digital watermark is typically stronger than a physical mark, because it is not obvious when you look at an image whether it has additional information. Having said that, this method provides no deterrent to a thief, although in theory it should make tracing your work (and in some cases derivative works) much easier.

4. The Window

If you want to show the level of detail in your high quality images without giving away too much "for free", then you could use what I refer to as the "window" method. Imagine you were looking at the full image through a square inch hole in a piece of paper; you wouldn’t be able to see much of the final image, but you will be able to see the quality and detail in the image without having to display the full image. I’ve seen this approach implemented in Java at some image galleries (allowing you to move the viewable window), although it is probably simpler (and quicker for your visitors) to use a cropped image based on the original.

Protecting your HTML

Using a script to disable right-click is not the most effective way of making your source code difficult to read. Most of the techniques used to protect HTML source code use JavaScript, so if visitors happen to have it switched off, the site becomes unusable.

There are three main JavaScript techniques used to protect the source code of a page:

  • Encode the source code to make it unreadable without decoding
  • Put the bulk of the source code in a JavaScript include
  • Open the page in a new window with all menus disabled (not recommended)

The only way to make it more difficult for curious people to decipher your HTML source code without having to resort to using JavaScript is to remove needless white space. The effect is to turn your code into one or more long lines of code so that anyone using the view source function in a browser finds it difficult to read without taking the time to tidy it up.

What Will You Protect?

Obviously, the alternatives you choose to use will depend on what you need to protect and how important its protection is. You should bear in mind that anyone who’s determined to steal your stuff will find a way to steal it — even if this means taking a screen capture or typing out an article you’ve disabled text highlighting on!

Of course, there is a much easier way to protect your content from would-be thieves without ever having to disable any browser functions. If you want to protect something that badly, don’t put it on the Web in the first place! For more information, see:


Category: Patterns & Practices Time: 2002-05-11 Views: 1

Related post

  • How to disable right click on certain websites 2012-10-17

    I am not asking this question from a web developer but from an end-user. I am using several web sites (google drive, evernote and so on) that have context menu that activates upon a right click event. However, on my browser (Firefox), if I right clic

  • Does disabling right click have any impact on security? 2013-02-21

    On a banking website I see that they have disabled right-click. Does that make the site any more secure? Is it a good general practice? --------------Solutions------------- Does it make the site any more secure? No, it doesn't alter anything other th

  • Disable right click in windows chrome 2014-09-30

    I am trying to run chrome in kiosk mode and disable right clicking. I'm using a autohotkey script on startup and my current script is below: #NoTrayIcon RButton::Return Run , C:\Program Files (x86)\Google\Chrome\Application\chrome.exe -kiosk

  • Disable Right Click Save Image Option [on hold] 2016-06-21

    I am making a website where I will post my photoshoot pictures. I don't want people to right click and save the image. But, I don't want to Disable right click. I just want that the save image option will not come. How can I achieve this ?

  • How to disable right click in nautilus? 2012-10-02

    i want to disable right click in nautilus using Ubuntu 12.04. how to do that? --------------Solutions------------- To disable right click for just desktop : xmodmap -e "pointer = 1 2 99" To apply for system wide: xmodmap -e 'pointer = 1 2 0 4 5

  • How to disable right click on windows 8? 2013-11-11

    I tried using the lockdown feature but apparently I cannot figure where to disable the right click action here. I also checked using the windows 8 embedded. I might be missing something. Can you give me an idea or answer how to do this? Thanks! -----

  • Userscript to bypass websites that disable right clicking in the browser? 2013-11-28

    I'm using a website that uses the following code in their html source (as discussed here on Stack Overflow), as a way to disable right-clicking on the web page: <body oncontextmenu="return false;"> I am assuming the easiest way to permanen

  • Disable right-click region on Synaptics Touchpad with V19.0.19 driver 2015-08-31

    The latest version (V19.0.19.1) of the Synaptics Touchpad drivers (SMBus, Windows 10) does not appear to have the option to disable right click functionality when clicking in the lower right portion of the Touchpad - see the attached screenshot. Does

  • Disable right click in windows 8 / windows 10 2015-12-05

    I want to disable right click in all applications in windows. If it is not possible, then at least in Chrome browser. Please note that I didn't mean it for kiosk mode or something similar. The problem is, my keyboard short cut for right click seems n

  • How to Disable right click button on redhat 6? 2016-01-02

    In my Redhat 6 Machine, I have 5 users: "user1", "user2", "user3", "user4", "user5". When I am logged in as "user1" or "user2", I want to disable right click on the Desktop but when I'm

  • Disable Right Click in React.JS 2016-01-27

    How to disable right click in canvas in ReactJS. Here is what i tried which is still not working. let Canvas = <canvas onContextMenu={(e)=> {e.preventDefault(); return false;}} height={500} width={500} ref="canvas"/>; A warning is also

  • Disable 'right-click' on Panasonic CF-H1 digitizer? 2011-08-24

    A remote user is complaining that their Panasonic CF-H1 tablet is not working. After additional feedback it was revealed that the digitizer pen's (stylus) right-click button is jammed. I remember that there is a setting to disable the right-click in

  • Does Disabling Right Click In Windows Explorer Do Anything? 2013-05-10

    I am at a student at a school which blocks the right click in Windows Explorer and the desktop, as well as on the taskbar. I don't exactly understand why they do this, since most of the commands on the right click menu are also avaliable in the File

  • How to disable right click in menus? 2014-01-05

    i'm having troubles with the right click, because when i press in dolphin or in chrome to open some menu action, the right click open the menu and start the first action in that menu in the same click! i want to disable the right click not for open m

  • How to disable right click on the touchpad 2015-03-27

    I am wondering if there is a way to disable the right click button while still being able to use the two-finger click option... my track pad is completely clickable and I often am clicking on things, accidentally opening a menu when I'm not trying to

  • How to disable right-click menu in terminal? 2011-01-13

    I'd like to disable right-mouse-click pop-up menu in Ubuntu terminal so that mouse right click to be passed to the application (Midnight Commander, to select files with the right mouse button). How to achieve this? --------------Solutions------------

  • How to Disable Right-Click in Windows XP / Windows 7? 2011-03-27

    What is the least invasive way (read: least amount of modification to the OS; or least invasive software or utility) to disable the right-click ability of a pointing device in Windows XP and/or Windows 7? Edit: apparently people are making silly assu

  • Disabling right click for a folder in a DVD, not allowing copy & paste functions 2011-03-27

    I have prepared a video DVD (DVD-5) and will be giving it to some of my friends. However, I wish to disable the right click option for the VIDEO_TS folder, so no one can copy the folder or the files inside the folder. I also do not want to allow Ctrl

  • Disable right click file printing in windows 7? 2012-10-09

    Is this possible to disable or remove the right click on a file print option? Seems like it should be possible. --------------Solutions------------- Those kinds of options on the right-click menu are assigned per file type. If you're only interested

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 1.378 (s). 13 q(s)