By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,934 Members | 1,441 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,934 IT Pros & Developers. It's quick & easy.

RIGHT Mouse Button - on Click? Prevent photo download

P: n/a
Hallo,

Does anyone have a (simple?) javascript code for me to
prevent that people take the photo's of my website while
they use the right mouse button.
I know that there are ways around this and people can
still get the picture, but in that case it is much less easier
and only the handy people can get it then. That already
helps.

Thanks so much,
Nicolien Avis
Jul 20 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
"Alpenvrouwtje" <al***********@nospam.com> writes:
Does anyone have a (simple?) javascript code for me to
prevent that people take the photo's of my website while
they use the right mouse button.
For maximum annoyance:
<body oncontextmenu="return false">

For less annoyance:

for (var i=0;i<document.images.length;i++) {
document.images[i].oncontextmenu = function (){ return false;};
}
I know that there are ways around this and people can
still get the picture, but in that case it is much less easier
and only the handy people can get it then.
That is pretty much anybody who can walk and chew gum at the same
time.
That already helps.


Who? What are you trying to achieve, except annoying users?

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

P: n/a
In article <tr**********************@amsnews02.chello.com>,
al***********@nospam.com enlightened us with...
Hallo,

Does anyone have a (simple?) javascript code for me to
prevent that people take the photo's of my website while
they use the right mouse button.
I know that there are ways around this and people can
still get the picture, but in that case it is much less easier
and only the handy people can get it then. That already
helps.


Anyone with enough sense to know how to disable javascript can get them.
That covers anyone under 40 and half the people over 40 who know what
javascript is.
Disabling the right mouse button disables other functions. Nothing like
pissing off all your users, eh?

You want to make it hard for people to get them? Cover them with a
spacer gif so right-click->save saves the spacer, not the image (can be
done with CSS or with tables with background image set to your image and
a spacer as the cell content). Then people have to go look up the name
of the image in your code and either get it from your server or their
browser cache. Set no-cache so that the page doesn't cache and protect
the file on your server with .htaccess and it really becomes a pain to
get it. The only way then is to open the file from the cache and save it
under a new name while the browser is open on the current page.

Is it really worth it when all you have to do to make people not want it
is watermark it?

-------------------------------------------------
~kaeli~
Hey, if you got it flaunt it! If you don't, stare
at someone who does. Just don't lick the TV screen,
it leaves streaks.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
Jul 20 '05 #3

P: n/a
Thanks. The code works.
Now I just noticed that some small icons appear
on top of the picture (photo) and that it is possible to download the photo
via the icons. You probably already
knew, I never knew what the icons where for. Is there
some way to get rid of the icons?

Thank you for your help.
Nicolien Avis
"Lasse Reichstein Nielsen" <lr*@hotpop.com> wrote in message
news:1x**********@hotpop.com...
"Alpenvrouwtje" <al***********@nospam.com> writes:
Does anyone have a (simple?) javascript code for me to
prevent that people take the photo's of my website while
they use the right mouse button.


For maximum annoyance:
<body oncontextmenu="return false">

For less annoyance:

for (var i=0;i<document.images.length;i++) {
document.images[i].oncontextmenu = function (){ return false;};
}
I know that there are ways around this and people can
still get the picture, but in that case it is much less easier
and only the handy people can get it then.


That is pretty much anybody who can walk and chew gum at the same
time.
That already helps.


Who? What are you trying to achieve, except annoying users?

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'

Jul 20 '05 #4

P: n/a
Alpenvrouwtje wrote:
Now I just noticed that some small icons appear
on top of the picture (photo) and that it is possible to download the photo
via the icons. Is there
some way to get rid of the icons?

<meta http-equiv="imagetoolbar" content="no">

I occasionally turn the toolbar off because it looks bad. There is an IE
attribute of the IMG tag (galleryimage="0" or something, not quite sure)
that can do it for a single image, but the page won't validate correctly.

Dom

Jul 20 '05 #5

P: n/a
rf

"Alpenvrouwtje" <al***********@nospam.com> wrote in message
news:tr**********************@amsnews02.chello.com ...
Hallo,

Does anyone have a (simple?) javascript code for me to
prevent that people take the photo's of my website while
they use the right mouse button.


Using the right mouse button to steal pictures is far too much trouble. One
has to negotiate menus and dialog boxes and all sorts of things.

It is *much* easier to simply left click on the image and drag it over to
ones image editor.

Aha, I hear you say. You'll disable the left mouse button as well :-)

Cheers
Richard.
Jul 20 '05 #6

P: n/a
In article <EE********************@news-server.bigpond.net.au>,
ma**********@the.time enlightened us with...

Using the right mouse button to steal pictures is far too much trouble. One
has to negotiate menus and dialog boxes and all sorts of things.

It is *much* easier to simply left click on the image and drag it over to
ones image editor.

Cool trick, but why can't I get it to work when the pictures are links?

*pout*
-------------------------------------------------
~kaeli~
Hey, if you got it flaunt it! If you don't, stare
at someone who does. Just don't lick the TV screen,
it leaves streaks.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
Jul 20 '05 #7

P: n/a
rf

"kaeli" <in********************@NOSPAMatt.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <EE********************@news-server.bigpond.net.au>,
ma**********@the.time enlightened us with...

Using the right mouse button to steal pictures is far too much trouble. One has to negotiate menus and dialog boxes and all sorts of things.

It is *much* easier to simply left click on the image and drag it over to ones image editor.
Cool trick, but why can't I get it to work when the pictures are links?


Because if the image is in a link you are drag/dropping the link, not the
image. You will have to drop down view>source, find the URL of the image and
copy/paste that into your browsers address bar. Then you can drag/drop the
image. No problem.

Cheers
Richard.
Jul 20 '05 #8

P: n/a
In article <2h********************@news-server.bigpond.net.au>,
ma**********@the.time enlightened us with...
Cool trick, but why can't I get it to work when the pictures are links?


Because if the image is in a link you are drag/dropping the link, not the
image. You will have to drop down view>source, find the URL of the image and
copy/paste that into your browsers address bar. Then you can drag/drop the
image. No problem.


Cool.
Thanks Richard.

-------------------------------------------------
~kaeli~
Hey, if you got it flaunt it! If you don't, stare
at someone who does. Just don't lick the TV screen,
it leaves streaks.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
Jul 20 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.