right click protect images

Posted on 2009-02-18
Last Modified: 2012-05-06
Hello Everyone:
What is the easiest way to prohibit right click menu options for the images on our site.  Basically, we have used the following code for the the thumbnail images; however, how do we protect the larger image linked to the thumbnail? Thank you very much.

<SCRIPT LANGUAGE="JavaScript1.1">

<!-- Begin
function right(e) {
if (navigator.appName == 'Netscape' &&
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2 || event.button == 3)) {
alert("Sorry, you do not have permission to right click.");
return false;
return true;

if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
//  End -->
Question by:gone_riding
    LVL 31

    Assisted Solution

    The idea behind this kind of protection is to prevent the user from easily figuring out what the URL of the image is. Once they know the URL, there's nothing you can do to stop them. That said, it's not possible to do that. Any savvy user can look at the page source, or examine the page in Firebug, identify the image on the server, and then download it directly. Disabling right click won't stop those who know what they're doing, and will annoy everyone else.

    That said, the way you prevent your larger images from being downloaded, is you do not ever link *directly* to an image from a thumbnail. Have your thumbnails to a separate "large version" page which displays the large image, and also protects from right clicks just like what you've already done.

    The only bulletproof way I can see of doing this is to have some kind of server side code deliver the images on a per-request basis, each page generating a "ticket" which gives it one time access to the images. You never link to a real image, instead you link to the server script that delivers the image. We can explore that option if you tell me what kind of server side languages you have available. PHP? ASP?
    LVL 9

    Accepted Solution

    Easiest way is to open your images in a custom-size pop-up window.
    Most of the normal internet users can't figure out the image name in Pop-up widow JavaScript.

    Then apply no-right-click script, and turn off menu-bar, toolbar of that pop-up window, then it would help, because many users don't know how to view page source of a pop-up window.

    Another optional addition to this, is applying a Window-close script/function on right click, so if someone tries to right-click on that pop-up, it will close. So next time he would just view your images and won't try to right-click on them...

    You cannot make it 100% safe, but at least it will prevent many...

    In fact, you can never make anything on a webpage 100% copy free, but can try it for general audience.

    LVL 26

    Assisted Solution

    by:David Brugge
    Another fun way is with CSS. Save a tiny transparent TIFF or PNG and stretch it across a DIV that sits above your image. Then let them right click and download the transparent TIFF to their hearts content.
    For added fun, make a nearly transparent message such as "Stop Stealing Images" that will not be visable over the image, but will show up when downloaded and viewed against a white background".
    Frosty makes a very good point about not being able to protect your image. The subject was nearly run into the ground here

    Author Comment

    Thank you for all of the responses and I apologize for not responding myself sooner.  I am interested in the custom-size pop-up window and stopping the right click behavior by applying a no-right-click script, and turning off menu-bars/toolbars of that pop-up window - would you happen to having any coding available for this?  Also, does anyone have any feedback on protware or web album generator?  
    Thanks again.
    LVL 9

    Assisted Solution

    To create pop-up window with custom size and properties, use this link:

    To prevent right-click, use the script:


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    I. Introduction In a previous article ( (now deprecated), I discussed how to upgrad…
    Keep your audience engaged and get the most out of your next presentation with these quick Prezi tips.
    Learn how to create interesting presentations by including videos to keep your audience engaged using Prezi. Select "Insert" from the top menu in your Prezi editor: Select "YouTube Video": Paste the video URL into the prompt: "Select "Insert":…
    In addition to being a great web-based presentation tool, Prezi also makes it easy to save your presentation as a PDF to share with others as well. Learn how in this tutorial. Select the share icon from the top menu in your Prezi editor: Select "D…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now