471,338 Members | 944 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Disabling right click without annoying popup

I know this is an annoying thing on some sites.

I have set some images in an online gallery to have their own java po
up window that is set to be the same size as the image.

I would like to set ONLY the pop up window so it does not allow th
user to right click.

Now I did a search, and found some options, but when you right click
it gives the user an annoying pop up saying stuff like "you cant d
this".

I have seen a site recently where nothing came up at all, but the righ
click was disabled.

If anyone knows how to do this, please let me know.

Cheers,

Jason
-
dukelet

Jul 23 '05 #1
20 1934
dukeleto <du*************@mail.forum4designers.com> writes:
I know this is an annoying thing on some sites.
Yes, and luckily some browsers ignore it completely. Mine included :)
I have set some images in an online gallery to have their own java pop
up window that is set to be the same size as the image.
JavaScript(!), not Java. Two different things.
I would like to set ONLY the pop up window so it does not allow the
user to right click.
If the window contains an HTML document, then you can just add an
oncontextmenu handler to the img element:
<img ... oncontextmenu="return false;">
If it just contains the image, then I am not sure you can do anything.
Now I did a search, and found some options, but when you right click,
it gives the user an annoying pop up saying stuff like "you cant do
this".
A good sign that whoever made it doesn't know what he is doing. Most
of these scripts use the "original" right click action that just
opens an alert. It can be bypassed simply by holding the right button
down and dismissing the alert with the keyboard. :)
I have seen a site recently where nothing came up at all, but the right
click was disabled.


Use the oncontextmenu="return false" attribute on the elements where
you want to disable the context menu. Don't do it on the entire page,
there is no need for that. And know that My browser and I don't care :)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #2
In article <6f******************************@news.thenewsgrou ps.com>,
du*************@mail.forum4designers.com enlightened us with...

I would like to set ONLY the pop up window so it does not allow the
user to right click.


*laughs*

I don't know why you think you need it, since I can get it back really
easily, but if you're dying for it...

<body onLoad="document.oncontextmenu = function(){return false}">

Works in most browsers in use these days. Last I checked, Opera has no
way to disable this. If you care about NN4, you'll need something a
little more complicated.

Note that this violates the guidelines for accessibility for the
disabled.

This will not prevent:
Getting the image from the cache.
Screen capture.
Drag and drop the image into an image editor.
Disable javascript and reload popup with F5.

If I want your image, it's mine unless you really go to extremes with
password protected directories that won't show the full image without a
user name and password (once I DO see it, it's also mine).
Don't want me to have it? Watermark it in an obvious place so I don't
want it. I can remove digital watermarks in about 3 seconds. You have to
use a real one that obscures the image and renders it undesirable.

--
--
~kaeli~
It was recently discovered that research causes cancer in
rats.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #3
kaeli <ti******@NOSPAM.comcast.net> writes:
Last I checked, Opera has no way to disable this.


It can be disabled by canceliing the appropriate mouse events, but
catching right clicks has to be enabled. It is disabled as default.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #4
dukeleto wrote:
I know this is an annoying thing on some sites.
On *all* sites that implement it.
I would like to set ONLY the pop up window so it does not allow the
user to right click.


You can't. Most browsers have options to prevent sites from interfering with
the context menu these days, and for those which don't you'll just confuse
a lot of users.

What do you hope to achieve anyway? Prevent people from saving the image?
Its already in the browser cache, is available by viewing source code,
available by turning JavaScript off, available through the many
bookmarklets which unblock context menu blockers, and the most simple
option is still there - drag and dropping the image somewhere.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #5
In article <fz**********@hotpop.com>, lr*@hotpop.com enlightened us
with...
kaeli <ti******@NOSPAM.comcast.net> writes:
Last I checked, Opera has no way to disable this.


It can be disabled by canceliing the appropriate mouse events, but
catching right clicks has to be enabled. It is disabled as default.


Ah, gotcha.
I left mine that way. :)
--
--
~kaeli~
If at first you don't succeed, skydiving is not for you.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #6
On Tue, 20 Jul 2004 15:17:10 GMT, dukeleto wrote:
I would like to set ONLY the pop up window so it does not allow the
user to right click.


Huh! Is that a way to get pics from web-pages?

I usually just D'n'D 'em to the desktop,
...if they're any good! ;-)

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #7
On Tue, 20 Jul 2004 11:01:54 -0500, kaeli
<ti******@NOSPAM.comcast.net> wrote:
Note that this violates the guidelines for accessibility for the
disabled.


You might like to note that according to an official from the UK
eGovernment initiative (AFAIR run by the Office of the Deputy Prime
Minister), failing to comply with W3C WAI rules is illegal in the UK.
There has been no case law as yet, but it is worth bearing in mind
that the Government thinks that the guidance it has given (to adhere
to WAI) has the force of law, and I presume that if the courts decided
otherwise they'd bring in legislation to enforce it. It wouldn't
surprise me if the current problems with the "Odeon" web-site
developed into a test case.

Paul

Jul 23 '05 #8
Paul Cooper wrote:
kaeli wrote:
Note that this violates the guidelines for accessibility
for the disabled.


You might like to note that according to an official from the
UK eGovernment initiative (AFAIR run by the Office of the
Deputy Prime Minister), failing to comply with W3C WAI rules
is illegal in the UK.

<snip>

WAI "rules" take the form of guidelines and some of those guidelines are
extremely subjective. e.g.:-

<quote cite="Web Content Accessibility Guidelines 1.0">
Checkpoints:
14.1 Use the clearest and simplest language appropriate for
a site's content. [Priority 1]
</quote>

Simplicity and appropriateness would be difficult to measure. Some
automated measure of simplicity might be available:-

<quote cite="http://www.w3.org/TR/WCAG10-CORE-TECHS/#comprehension">
To help determine whether your document is easy to read, consider using
the Gunning-Fog reading measure (described in [SPOOL] with examples and
the algorithm online at [TECHHEAD]). This algorithm generally produces a
lower score when content is easier to read. As example results, the
Bible, Shakespeare, Mark Twain, and TV Guide all have Fog indexes of
about 6. Time, Newsweek, and the Wall St. Journal an average Fog index
of about 11.
</snip>

- but the fact that these figures have grouped the Bible, Shakespeare,
and TV Guide highlights the problem of appropriateness (TV Guide in the
style of Shakespeare; maybe simple, but far from appropriate).

If the WAI cannot lay down hard and fast rules (and they are far too
realistic to believe that they can effectively do that in many cases)
then the UK government cannot require that those "rules" be followed as
such.

My interpretation of the (UK) DDA, especially; PART III - DISCRIMINATION
IN OTHER AREAS: 19(3)(c) "access to and use of information services"
(19(3). 'examples of services to which ... apply'), is that the act is
intended to apply to web sites (commercial and otherwise - 19(2)(c) "it
is irrelevant whether a service is provided on payment or without
payment"). And following WCAG 1.0 (with a reasonable interpretation of
the more ambiguous/subjective parts) should satisfy the requirements of
the act.

Richard.
Jul 23 '05 #9
In article <dl********************************@4ax.com>,
pa*********@Nobasspam.ac.uk enlightened us with...

You might like to note that according to an official from the UK
eGovernment initiative (AFAIR run by the Office of the Deputy Prime
Minister), failing to comply with W3C WAI rules is illegal in the UK.
There has been no case law as yet, but it is worth bearing in mind
that the Government thinks that the guidance it has given (to adhere
to WAI) has the force of law, and I presume that if the courts decided
otherwise they'd bring in legislation to enforce it. It wouldn't
surprise me if the current problems with the "Odeon" web-site
developed into a test case.

I live in the States, but I'm curious - do you know if the UK law
applies to:
1. personal (non-business, owned by private citizens) pages with .uk
domains?
2. any pages outside .uk domains?

If yes to 2, how could they possibly hope to enforce it? They'd be out
of their jurisdiction, wouldn't they?

Just wondering.

This might be worth noting on my site when I put up scripts that don't
meet the guidelines.
IIRC, anything that disables the contextmenu is bad and anything that
does something with mouse events must also do it for key events, right?

--
--
~kaeli~
What do they use to ship styrofoam?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #10
On Wed, 21 Jul 2004 07:55:42 -0500, kaeli
<ti******@NOSPAM.comcast.net> wrote:
In article <dl********************************@4ax.com>,
pa*********@Nobasspam.ac.uk enlightened us with...

You might like to note that according to an official from the UK
eGovernment initiative (AFAIR run by the Office of the Deputy Prime
Minister), failing to comply with W3C WAI rules is illegal in the UK.
There has been no case law as yet, but it is worth bearing in mind
that the Government thinks that the guidance it has given (to adhere
to WAI) has the force of law, and I presume that if the courts decided
otherwise they'd bring in legislation to enforce it. It wouldn't
surprise me if the current problems with the "Odeon" web-site
developed into a test case.

I live in the States, but I'm curious - do you know if the UK law
applies to:
1. personal (non-business, owned by private citizens) pages with .uk
domains?
2. any pages outside .uk domains?

If yes to 2, how could they possibly hope to enforce it? They'd be out
of their jurisdiction, wouldn't they?

Just wondering.

This might be worth noting on my site when I put up scripts that don't
meet the guidelines.
IIRC, anything that disables the contextmenu is bad and anything that
does something with mouse events must also do it for key events, right?

--

As far as I am aware (and I am very aware I am not an expert in this
field) it applies to any web page that is providing a service, whether
paid for or not. Of course, it only applies to pages hosted in the UK,
but similar rules apply over the whole EC. The principle is that
information or services available to an able bodied person _must_ also
be available to disabled persons. I think the basic context is that of
Human Rights. This is easy enough to comply with in some contexts -
for example, all images should have ALT text describing the
information content of the image. In others (and I was at a meeting of
mapping and GIS people!) it is clearly very difficult.

The person who gave the presentation suggested there were three levels
of compliance with the WAI - one "A" which about 70-80% of sites
manage, 2 "A", which about 20% of sites manage and 3 "A" which almost
none manage. His opinion was that the level to strive for was 2 "A". I
don't know if that is meaningful to persons who know the WAI better
than I.

If I understood the context properly, there was also a
"reasonableness" judgement. For example, it is unreasonable to ask
that a general location map be made accessible to a blind person -
there is no generally available technology that a blind person could
use to "visualize" the map - even the idea of visualization may be
foreign to a person blind from birth. However, the web-site should
make available (for example) directions from public transport nodes to
the place located by the map. And sites which (for example) show the
nearest hotels to your location should have this information available
in forms accessible to screen-readers. I did ask how you were expected
to make (say) the "Eroica" Symphony accessible to a profoundly deaf
person and got a wry answer!

Paul
Jul 23 '05 #11
In article <g2********************************@4ax.com>,
pa*********@Nobasspam.ac.uk enlightened us with...
As far as I am aware (and I am very aware I am not an expert in this
field) it applies to any web page that is providing a service, whether
paid for or not.
But don't ALL pages provide a "service", even if that service is just to
inform or entertain?
How might they define "service"?

If I understood the context properly, there was also a
"reasonableness" judgement.


This makes sense, but would be hard to make concrete.

Thanks for the info.

--
--
~kaeli~
Those who jump off a bridge in Paris... are in Seine.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #12
On Wed, 21 Jul 2004 09:13:19 -0500, kaeli
<ti******@NOSPAM.comcast.net> wrote:
In article <g2********************************@4ax.com>,
pa*********@Nobasspam.ac.uk enlightened us with...
As far as I am aware (and I am very aware I am not an expert in this
field) it applies to any web page that is providing a service, whether
paid for or not.


But don't ALL pages provide a "service", even if that service is just to
inform or entertain?
How might they define "service"?

If I understood the context properly, there was also a
"reasonableness" judgement.


This makes sense, but would be hard to make concrete.

Thanks for the info.

--


Agree to both points! Which is why this is regarded as such a big deal
by corporate web-masters over here. It is, of course, very unlikely
that someone running a small personal set of pages would be bothered.
However, it is a big deal for government web-sites, or for large
corporations.

Paul
Jul 23 '05 #13
kaeli wrote:
pa*********@Nobasspam.ac.uk wrote:
As far as I am aware (and I am very aware I am not an expert in this
field) it applies to any web page that is providing a service,
whether paid for or not.


But don't ALL pages provide a "service", even if that
service is just to inform or entertain?
How might they define "service"?


Information and entertainment are explicitly covered:-

<quote cite="(UK) DDA, PART III-DISCRIMINATION IN OTHER AREAS">
19.Discrimination in relation to goods, facilities and services.
....
(2) For the purposes of this section and sections 20 and 21-

(a) the provision of services includes the provision of any goods
or facilities;

(b) a person is "a provider of services" if he is concerned with
the provision, in the United Kingdom, of services to the
public or to a section of the public; and

(c) it is irrelevant whether a service is provided on payment or
without payment.

(3) The following are examples of services to which this section and
sections 20 and 21 apply-

(a) access to and use of any place which members of the public
are permitted to enter;

(b) access to and use of means of communication;

(c) access to and use of information services;

(d) accommodation in a hotel, boarding house or other similar
establishment;

(e) facilities by way of banking or insurance or for grants,
loans, credit or finance;

(f) facilities for entertainment, recreation or refreshment;

(g) facilities provided by employment agencies or under section
2 of the Employment and Training Act 1973;

(h) the services of any profession or trade, or any local or
other public authority.
....
</quote>
If I understood the context properly, there was also a
"reasonableness" judgement.


This makes sense, but would be hard to make concrete.


Reasonableness is always subject to interpretation, but there is also a
criteria of expense (equally unclear):-

<quote cite="(UK) DDA, PART III-DISCRIMINATION IN OTHER AREAS">
21.Duty of providers of services to make adjustments. -

(1) Where a provider of services has a practice, policy or procedure
which makes it impossible or unreasonably difficult for disabled
persons to make use of a service which he provides, or is
prepared to provide, to other members of the public, it is his
duty to take such steps as it is reasonable, in all the
circumstances of the case, for him to have to take in order to
change that practice, policy or procedure so that it no longer
has that effect.

....

(4) Where an auxiliary aid or service (for example, the provision of
information on audio tape or of a sign language interpreter) would-

(a) enable disabled persons to make use of a service which a
provider of services provides, or is prepared to provide,
to members of the public, or

(b) facilitate the use by disabled persons of such a service,

it is the duty of the provider of that service to take such steps
as it is reasonable, in all the circumstances of the case, for
him to have to take in order to provide that auxiliary aid or
service.

(5) Regulations may make provision, for the purposes of this section-

(a) as to circumstances in which it is reasonable for a provider
of services to have to take steps of a prescribed description;

(b) as to circumstances in which it is not reasonable for a
provider of services to have to take steps of a prescribed
description;

(c) as to what is to be included within the meaning of "practice,
policy or procedure";

(d) as to what is not to be included within the meaning of that
expression;

(e) as to things which are to be treated as physical features;

(f) as to things which are not to be treated as such features;

(g) as to things which are to be treated as auxiliary aids or
services;

(h) as to things which are not to be treated as auxiliary aids
or services.

(6) Nothing in this section requires a provider of services to take
any steps which would fundamentally alter the nature of the
service in question or the nature of his trade, profession or
business.

(7) Nothing in this section requires a provider of services to take
any steps which would cause him to incur expenditure exceeding
the prescribed maximum.

(8) Regulations under subsection (7) may provide for the prescribed
maximum to be calculated by reference to-

(a) aggregate amounts of expenditure incurred in relation to
different cases;

(b) prescribed periods;

(c) services of a prescribed description;

(d) premises of a prescribed description; or

(e) such other criteria as may be prescribed.

(9) Regulations may provide, for the purposes of subsection (7),
for expenditure incurred by one provider of services to be
treated as incurred by another.

(10) This section imposes duties only for the purpose of determining
whether a provider of services has discriminated against a
disabled person; and accordingly a breach of any such duty is
not actionable as such.
</quote>

Richard.
Jul 23 '05 #14
In article <cd*******************@news.demon.co.uk>,
Ri*****@litotes.demon.co.uk enlightened us with...

<quote cite="(UK) DDA, PART III-DISCRIMINATION IN OTHER AREAS">


Do you have the URL handy to this site, assuming it is online?
I'd like to look over the whole thing.

Thanks!

--
--
~kaeli~
A little rudeness and disrespect can elevate a meaningless
interaction to a battle of wills and add drama to an
otherwise dull day.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #15
On Wed, 21 Jul 2004 16:23:09 +0100, "Richard Cornford"
<Ri*****@litotes.demon.co.uk> wrote:


Richard.

Thanks, Richard!

I note that the concept of "reasonableness" is common in UK law, so
there are probably piles of case law that establishes rules on how to
determine what is reasonable!

Paul
Jul 23 '05 #16
kaeli wrote:
Richard Cornford wrote:

<quote cite="(UK) DDA, PART III-DISCRIMINATION IN OTHER AREAS">


Do you have the URL handy to this site, assuming it is online?
I'd like to look over the whole thing.


<URL: http://www.legislation.hmso.gov.uk/a...95/1995050.htm >

Richard.
Jul 23 '05 #17
In article <cd*******************@news.demon.co.uk>,
Ri*****@litotes.demon.co.uk enlightened us with...
kaeli wrote:
Richard Cornford wrote:

<quote cite="(UK) DDA, PART III-DISCRIMINATION IN OTHER AREAS">


Do you have the URL handy to this site, assuming it is online?
I'd like to look over the whole thing.


<URL: http://www.legislation.hmso.gov.uk/a...95/1995050.htm >

Thanks a ton!

--
--
~kaeli~
Black holes were created when God divided by 0.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #18
In article <cd*******************@news.demon.co.uk>,
Ri*****@litotes.demon.co.uk enlightened us with...
kaeli wrote:
Richard Cornford wrote:

<quote cite="(UK) DDA, PART III-DISCRIMINATION IN OTHER AREAS">


Do you have the URL handy to this site, assuming it is online?
I'd like to look over the whole thing.


<URL: http://www.legislation.hmso.gov.uk/a...95/1995050.htm >

Richard.


If anyone is interested in the US version, which as far as I know is
totally optional but really, really appreciated by people with
disabilities, I found it here.
Web Accessibility Guidelines (US): <URL: http://www.w3.org/TR/WCAG10/ >

--
--
~kaeli~
A little rudeness and disrespect can elevate a meaningless
interaction to a battle of wills and add drama to an
otherwise dull day.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #19
On Wed, 21 Jul 2004 14:47:43 +0100, Paul Cooper wrote:
In article pa*********@Nobasspam.ac.uk enlightened us with...

...failing to comply with W3C WAI rules is illegal in the UK.
... ..I think the basic context is that of Human Rights.


The UDoHR? The closest I can see in the declaration are..
<http://www.athompson.info/rights/declaration.jsp#21.2>
If the interenet can be interepreted the equivalent of 'public'
<http://www.athompson.info/rights/declaration.jsp#27.1>

HTH

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #20
On Wed, 21 Jul 2004 21:33:21 GMT, Andrew Thompson
<Se********@www.invalid> wrote:
On Wed, 21 Jul 2004 14:47:43 +0100, Paul Cooper wrote:
In article pa*********@Nobasspam.ac.uk enlightened us with...

...failing to comply with W3C WAI rules is illegal in the UK.

..
..I think the basic context is that of Human Rights.


The UDoHR? The closest I can see in the declaration are..
<http://www.athompson.info/rights/declaration.jsp#21.2>
If the interenet can be interepreted the equivalent of 'public'
<http://www.athompson.info/rights/declaration.jsp#27.1>

HTH

No, European Human Rights legislation, not the UN version which is
much more general.

Paul
Jul 23 '05 #21

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by George Hester | last post: by
1 post views Thread by thomasp | last post: by
4 posts views Thread by Prateek | last post: by
13 posts views Thread by lightzizo | last post: by
5 posts views Thread by hp_1981 | last post: by
5 posts views Thread by TC | last post: by
4 posts views Thread by vickeybird | last post: by
reply views Thread by rosydwin | last post: by

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.