PDA

View Full Version : protect all pics of message board with javascript


ptbyjason
12-18-2001, 03:55 PM
I know there is a way to add javascript to a website so that it protects the images you have on there (visitor cannot right click and save the image). Is there anyway to add it to a site so that you can protect the pictures that people post. There might also be a way that you can use it to protect buttons, logos, avatars, etc...... But I am mainly interested in protecting posted pics.

LuBi
12-19-2001, 05:09 AM
interested in this one, have seen it a few times but never got it right..

Bimma Boy
12-20-2001, 02:08 AM
This would keep the general riff raff out!

Wondeful.. pls can someone implement this hack.. will be very useful! ;)

Konqueror
12-20-2001, 09:12 AM
That wouldn' really be a protection. Users could still view the html code and get the pictures from there or simply use the "Save As" option in Internet Explorer which saves the page including the pictures anyway.

ptbyjason
12-20-2001, 11:53 AM
I see your point Konqueror. They could also use a program like HardCopy and clip the files from the page.
But to be totally honest, the guys that visit my website will not be able to do anything more than right click and do a "save as....". If that doesn't work 99.9% of them would give up. Only about 0.1% would keep trying until they found a way to get it. I want to use it as a deterrent. As many people as I have asking me everyday how to use the basic controls of the message board, I feel I will be pretty safe with a hack like this. :p

Konqueror
12-20-2001, 01:05 PM
Hehe, I guess that such a hack would be really useful for you then. ;)
Should all right-clicking be disabled? If so, then put this code somewhere in the "Head Insert":

<SCRIPT language=JavaScript>
<!--
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("Right-clicking is disabled."); document.layers; return false;}
return true;}
document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;
// -->
</SCRIPT>

damicatz
12-20-2001, 02:00 PM
It's not worth putting that kind of Javascript in. The only thing it does is annoy the heck out of your users. Their are other things in the right click menu besides save as and many users use those functions.

The only true way to prevent someone from stealing your pictures is to not have pictures on your site. For example if I wanted a picture I could just take a screenshot of it and with a bit of work in Photoshop I could have a copy of that picture.

LuBi
12-20-2001, 02:13 PM
Well it is more difficult, what I meant was a way to stop sharing my images. So users steal my avatars to use on other forums taking bandwith. I've seen this done with .htaccess properly jus tI never got the code right or atleast it never worked for me...

[QUOTE]Originally posted by damicatz
It's not worth putting that kind of Javascript in. The only thing it does is annoy the heck out of your users. Their are other things in the right click menu besides save as and many users use those functions.

The only true way to prevent someone from stealing your pictures is to not have pictures on your site. For example if I wanted a picture I could just take a screenshot of it and with a bit of work in Photoshop I could have a copy of that picture.

ptbyjason
12-20-2001, 02:36 PM
Thanks Konqueror I didn't know it was going to be that easy.

damicatz, honestly very few guys that visit my website have any photoshop skills. I have almost 2,000 members on my board and I found 2 people in one weeks time that knew enough about photoshop to help me complete a project I was working on. Very sad but true. Also the point you made about avoiding pictures is unavoidable on my website. It is a must. But everyone uses pictures on their website even if it is nothing more than the custom buttons that they create for it.

The point you made about annoying the users is understandable. I do wonder though if there is a way to only disable the "Save as..." part of the bar when you right click? That would probably be the best way for everyone.

Konqueror, I am going to give that a try, thanks again man.

leagleaze
08-31-2003, 10:07 PM
I copied this code from a site (credit included) it enables you to disable right clicking just on photos. I haven't installed it yet, because my problem is, I am not sure exactly where to put it. Can anyone tell me this? (I don't do much coding work on my site.)

I did create a plain old html page and test it, and it works, it lets you right click everywhere but on an image.

Thanks

L


<SCRIPT LANGUAGE="JavaScript">


<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->


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


function trap()
{
if(document.images)
{
for(i=0;i<document.images.length;i++)
{
document.images[i].onmousedown = right;
document.images[i].onmouseup = right;
}
}
}
// End -->
</SCRIPT>
</HEAD>


<!-- STEP ONE: Copy the event handler into the BODY tag -->


<BODY onLoad="trap()">


<!-- Script Size: 0.81 KB -->

Sadie Frost
01-22-2007, 08:19 PM
Just in case anyone is interested I found some code here: http://www.dynamicdrive.com/dynamicindex9/noright2.htm that when I put it in my headinclude works on all pages and you don't need the page to be completely loaded for it to work. :)

Zia
01-23-2007, 08:07 AM
umm those codes r for IE & Netscape ? but what about Opera & Firefox?

RedTyger
01-23-2007, 08:29 AM
It's pointless to do this. Hell, all they have to do is turn javascript off. Or view the source. Or their cache. Or print screen. And probably any number of other ways too. It's irritating and ineffective. If you want halfway decent protection, watermark.

RFViet
01-24-2007, 01:54 PM
[QUOTE=RedTyger;1165621]It's pointless to do this. Hell, all they have to do is turn javascript off.

bashy
01-24-2007, 07:14 PM
Or you could highlight the image then use the edit menu ;)

redspider
01-25-2007, 12:45 AM
even if you create a hack for it people can still use a software like snagit and take the picture they want .

Sadie Frost
02-11-2007, 01:27 AM
Of course they can. No one is doubting that. Print Screen does wonders. I'm not stupid.

But the site I'm doing this for had a request from someone who had donated their smilies for this, or they wanted their smilies removed. So if for some such reason you need to disable right click, here it is.

But you know, now people can't say "oh I didn't know I wasn't allowed to use it"...