Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

to stop itright clicking & saving pics

Status
Not open for further replies.

alice20

Programmer
Jun 27, 2001
21
0
0
GB
Hello,

Is there a way to stop someone from right clicking on an image and being able to save it from my website with some code?

Thanks

Emily
 
No.

If the user can see the image, then they already have it on their PC. That's what browsers do!

Greg.
 
The script below will disable the right click for the entire page. I have not tested it on browsers earlier than NS6 or IE5.
Another method is to break apart your images so the user only gets part of the image when they right click.

<script language=&quot;Javascript&quot;>

var ErrMsg = &quot;© Copyright Your Company, Inc. , 2001 &quot;;

function disableRightClick(btnClick)
{
if (navigator.appName == &quot;Netscape&quot; && btnClick.which == 3) // check for netscape and right click
{
alert(ErrMsg);
return false;
}
else if (navigator.appName ==&quot;Microsoft Internet Explorer&quot; && event.button == 2) // check for IE and Right Click
{
alert(ErrMsg);
return false;
}
}
document.onmousedown = disableRightClick;
</script> Eric

Starting GA/AL Focus User Group (FUSE) in Atlanta. See IBI website for usergroup info or contact me at eric.searing@wcom.com.
 
Hi,

My personal opinion is that if you are going to disable the right click then you might as well put a custom menu there instead.

A lot of people will be very annoyed that you have disabled the right click and some will try harder to get the images and as mentioned before, the image is already in the users temporary internet files.

You can see the menu at


Just view source to get the code or if you want I can post the code here.

Hope this helps Wullie

 
bah, don't do it. its nothing but anoying. i can understand you don't want people taking your pics, but to tell you the truth, wrighting that on the page would probly bo a better job then taking away right clicking.

you can also get them by viewing the sorce and going to the file by itself. the only actual way to stop it, is breaking up your pics, like esearing said.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top