• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 307
  • Last Modified:

right click protect images

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;
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;
//  End -->
</script>
</HEAD>
0
gone_riding
Asked:
gone_riding
4 Solutions
 
Frosty555Commented:
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?
0
 
knonieCommented:
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.

:-D
0
 
David BruggeCommented:
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 http://www.experts-exchange.com/Web_Development/Images/Q_21912288.html
0
 
gone_ridingAuthor Commented:
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.
0
 
knonieCommented:
To create pop-up window with custom size and properties, use this link:
http://www.dynamicdrive.com/dynamicindex8/popwin.htm

To prevent right-click, use the script:
http://www.dynamicdrive.com/dynamicindex9/noright3.htm

:-)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now