473,387 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

RIGHT Mouse Button - on Click? Prevent photo download

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
8 9747
"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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Lijun Yang | last post by:
Hey, I am able to disable the right mouse button on images for netscape and IE but it won't work for Opera. Here is the code: // start of the code var clickmessage="Sorry, you don't have...
5
by: Someone | last post by:
I know many don't like having right click disabled, however this is a unique case where clients using viewing this particular site will not be world wide so it's not going to affect too many...
12
by: Veeresh | last post by:
In my asp.net application I want to block mouse right click on my web pages. That means instead of popup menu I may just display some message or no message at all. Hot to do that? Thanks, Veer
13
by: James Bond | last post by:
Hello. My 80+ year old father has recently decided to get his first computer. Due to his age (and I suspect lack of playing pong as a child like I did) he lacks the manual dexterity to use a mouse...
2
by: Dino M. Buljubasic | last post by:
I have a list view with couple of items in it. When I left click on an item, a form opens displaying that item's properties. So that works fine. However, accidentally I found out that when I...
4
by: Pucca | last post by:
How can I tell a mouse right clicks over a listview item that's in a container panel. I only want to display a popup menu if the user right click the mouse over an item on the Listview. I don't...
7
by: Steve | last post by:
How do you disable the mouse right click to prevent pop-up window? Or if I want to have cut/copy/paste on pop-up window use same code as my custom cut/copy/paste that are triggered by toolstrip...
2
by: ImageAnalyst | last post by:
Does anyone know how to get rid of excess mouse clicks? I have a button that does some code which takes some time to execute. As soon as the user clicks the button, I disable the button in the...
8
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I disable the right mouse button? -----------------------------------------------------------------------...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.