ASP Hosting sale!
Double disk space and transfer for FREE!
Limited time offer! Act Now!

aspdev | articles | tutorials | forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Javascript to protect images?

 
Post new topic   Reply to topic    ASPdev.org Forum Index -> JavaScript / DHTML / HTML / CSS
View previous topic :: View next topic  
Author Message
twinkle



Joined: 31 Jan 2006
Posts: 79

PostPosted: Tue Jan 31, 2006 9:21 pm    Post subject: Javascript to protect images? Reply with quote

Is there an easy javascript I can implement that prevents people from righ-click saving my images?
_________________
I shine
Back to top
View user's profile Send private message
raven



Joined: 31 Jan 2006
Posts: 41

PostPosted: Wed Feb 01, 2006 10:14 am    Post subject: Reply with quote

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
View user's profile Send private message
TheWorks



Joined: 15 Oct 2004
Posts: 7

PostPosted: Wed Feb 01, 2006 10:27 am    Post subject: Reply with quote

There is no reliable way to prevent somebody from downloading yourn images or looking at your code Wink
Back to top
View user's profile Send private message
twinkle



Joined: 31 Jan 2006
Posts: 79

PostPosted: Wed Feb 01, 2006 1:12 pm    Post subject: Reply with quote

TheWorks wrote:
There is no reliable way to prevent somebody from downloading yourn images or looking at your code Wink


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
View user's profile Send private message
TheWorks



Joined: 15 Oct 2004
Posts: 7

PostPosted: Wed Feb 01, 2006 1:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
twinkle



Joined: 31 Jan 2006
Posts: 79

PostPosted: Thu Feb 02, 2006 4:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
mon



Joined: 03 Feb 2006
Posts: 3

PostPosted: Fri Feb 03, 2006 5:49 am    Post subject: Reply with quote

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 Very Happy
Back to top
View user's profile Send private message
Stitch



Joined: 07 Feb 2006
Posts: 43

PostPosted: Fri Feb 10, 2006 4:50 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address MSN Messenger
raven



Joined: 31 Jan 2006
Posts: 41

PostPosted: Thu Feb 23, 2006 1:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
Isaac



Joined: 01 Mar 2006
Posts: 4

PostPosted: Fri Mar 03, 2006 1:43 am    Post subject: Reply with quote

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
View user's profile Send private message
paul



Joined: 11 Oct 2004
Posts: 128

PostPosted: Mon Mar 06, 2006 10:37 am    Post subject: Reply with quote

Isaac wrote:
There's a few good tools here if you want to pay for them:
http://www.softplatz.com/kw/image-protection/


Have you used their tools? How exactly does this image protection thing work?



Thanks,

Paul
_________________
World Countries | Survival Skills
Back to top
View user's profile Send private message
bongo



Joined: 07 Mar 2006
Posts: 11

PostPosted: Tue Mar 07, 2006 12:49 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ASPdev.org Forum Index -> JavaScript / DHTML / HTML / CSS All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group

SQL Tutorial