View previous topic :: View next topic |
Author |
Message |
twinkle
Joined: 31 Jan 2006 Posts: 79
|
Posted: Tue Jan 31, 2006 9:21 pm Post subject: Javascript to protect images? |
|
|
Is there an easy javascript I can implement that prevents people from righ-click saving my images? _________________ I shine |
|
Back to top |
|
|
raven
Joined: 31 Jan 2006 Posts: 41
|
Posted: Wed Feb 01, 2006 10:14 am Post subject: |
|
|
Code: | <script language=JavaScript>
<!--
//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com
var message="Function Disabled!";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script> |
This comes from http://www.dynamicdrive.com/dynamicindex9/noright.htm
you can either change the message variable or alternatively swap out the alert message with another function call.
This does not prevent users from turning off javascript and stealing your images, however. If you are concerned that someone may want to steal your images and it is appropriate consider adding a watermark to your images. _________________ Programmers do it in code |
|
Back to top |
|
|
TheWorks
Joined: 15 Oct 2004 Posts: 7
|
Posted: Wed Feb 01, 2006 10:27 am Post subject: |
|
|
There is no reliable way to prevent somebody from downloading yourn images or looking at your code |
|
Back to top |
|
|
twinkle
Joined: 31 Jan 2006 Posts: 79
|
Posted: Wed Feb 01, 2006 1:12 pm Post subject: |
|
|
TheWorks wrote: | There is no reliable way to prevent somebody from downloading yourn images or looking at your code |
What do you mean? How would they get around it. Excuse my ignorance. I had heard you could prevent people from getting access.
Maybe it will at least keep the casual person away.
Thanks for the code Raven, I will give it a shot. _________________ I shine |
|
Back to top |
|
|
TheWorks
Joined: 15 Oct 2004 Posts: 7
|
Posted: Wed Feb 01, 2006 1:26 pm Post subject: |
|
|
They can always open your page in IE, click View from the menu, then click Source and view your source. From your siource they can view the path to any image, for example http://www.aspdev.org/Images/left_top.gif and if they type this into a browser it will load the image directly and they can save it. |
|
Back to top |
|
|
twinkle
Joined: 31 Jan 2006 Posts: 79
|
Posted: Thu Feb 02, 2006 4:48 pm Post subject: |
|
|
TheWorks wrote: | They can always open your page in IE, click View from the menu, then click Source and view your source. From your siource they can view the path to any image, for example http://www.aspdev.org/Images/left_top.gif and if they type this into a browser it will load the image directly and they can save it. |
Ah... Well I know you can prevent other sites from hotlinking your images, but there is no way to stop a user from bypassing the normal display from pulling up the image directly? I was under the impression you could, but obviously am wrong.
That is too bad. _________________ I shine |
|
Back to top |
|
|
mon
Joined: 03 Feb 2006 Posts: 3
|
Posted: Fri Feb 03, 2006 5:49 am Post subject: |
|
|
raven wrote: | Code: | <script language=JavaScript>
<!--
//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com
var message="Function Disabled!";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script> |
This comes from http://www.dynamicdrive.com/dynamicindex9/noright.htm
you can either change the message variable or alternatively swap out the alert message with another function call.
This does not prevent users from turning off javascript and stealing your images, however. If you are concerned that someone may want to steal your images and it is appropriate consider adding a watermark to your images. |
wow its works for me thanks for it |
|
Back to top |
|
|
Stitch
Joined: 07 Feb 2006 Posts: 43
|
Posted: Fri Feb 10, 2006 4:50 pm Post subject: |
|
|
twinkle wrote: | TheWorks wrote: | They can always open your page in IE, click View from the menu, then click Source and view your source. From your siource they can view the path to any image, for example http://www.aspdev.org/Images/left_top.gif and if they type this into a browser it will load the image directly and they can save it. |
Ah... Well I know you can prevent other sites from hotlinking your images, but there is no way to stop a user from bypassing the normal display from pulling up the image directly? I was under the impression you could, but obviously am wrong.
That is too bad. |
Designers are never protected unless you have an actual watermark on the image. Someone could always take a screenshot, and crop it out from there as well. |
|
Back to top |
|
|
raven
Joined: 31 Jan 2006 Posts: 41
|
Posted: Thu Feb 23, 2006 1:48 pm Post subject: |
|
|
By the way I figured this out myself too. I found a site that was keeping me from right clicking on the images so all I did was load the source and find the image location in the source code and bring them up.
Sure it will take some more work, but often times that is enough. You can not prevent anyone who is serious about getting it, but you can keep the casual people from doing it. _________________ Programmers do it in code |
|
Back to top |
|
|
Isaac
Joined: 01 Mar 2006 Posts: 4
|
Posted: Fri Mar 03, 2006 1:43 am Post subject: |
|
|
Yeah it's really hard to keep people from downloading your images completely. The javascript code is more like a big sign saying don't touch and a thether tied around it. You can just step over, but many people will be polite and look with their eyes.
There's a few good tools here if you want to pay for them:
http://www.softplatz.com/kw/image-protection/ |
|
Back to top |
|
|
paul
Joined: 11 Oct 2004 Posts: 128
|
Posted: Mon Mar 06, 2006 10:37 am Post subject: |
|
|
Have you used their tools? How exactly does this image protection thing work?
Thanks,
Paul _________________ World Countries | Survival Skills |
|
Back to top |
|
|
bongo
Joined: 07 Mar 2006 Posts: 11
|
Posted: Tue Mar 07, 2006 12:49 pm Post subject: |
|
|
I think that if the people wanted to steal the images, they wil have a way. They can view source and they can see the link of the images. After that, they can directly download from the browser. |
|
Back to top |
|
|
|