FAQ Topic - How do I disable the right mouse button?

F

FAQ server

-----------------------------------------------------------------------
FAQ Topic - How do I disable the right mouse button?
-----------------------------------------------------------------------

The oncontextmenu intrinsic event is the only safe and reliable
method. Of the other approaches often presented, most depend on
an alert box interrupting the process and rarely work. Note that
oncontextmenu is a non-standard event and is not supported on
all browsers.
` <body oncontextmenu="return false"> `


===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://jibbering.com/faq/index.html.
The FAQ workers are a group of volunteers.
 
S

Seth Illgard

-----------------------------------------------------------------------
FAQ Topic - How do I disable the right mouse button?
-----------------------------------------------------------------------

The oncontextmenu intrinsic event is the only safe and reliable
method. Of the other approaches often presented, most depend on
an alert box interrupting the process and rarely work. Note that
oncontextmenu is a non-standard event and is not supported on
all browsers.
` <body oncontextmenu="return false"> `

===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is athttp://jibbering.com/faq/index.html.
The FAQ workers are a group of volunteers.

That can only be done in IE. Its a very simple script which only
checks which mouse button was pressed when a mouse event is triggered.
Ask google "the wise" for the script. Im sure he knows it.
 
R

Randy Webb

Seth Illgard said the following on 3/4/2007 7:24 PM:
That can only be done in IE.

Are you referring to oncontextmenu or some other script?
Its a very simple script which only checks which mouse button was
pressed when a mouse event is triggered.

What script?
 
W

Walton

Note that
oncontextmenu is a non-standard event and is not supported on
all browsers.
` <body oncontextmenu="return false"> `

opera in particular. anyone know of any others?
 
R

Randy Webb

Walton said the following on 3/5/2007 1:44 PM:
opera in particular. anyone know of any others?

Honestly, who cares? The only people that would care are people that are
trying to interfere with my mouse.
 
W

Walton

Honestly, who cares? The only people that would care are people that are
trying to interfere with my mouse.

I would be one of those people. If you're building a rich web app, I
can think of a few good reasons to disable the right mouse click. One
example would be if you want your own popup menu on rt click.
Another would be if you're, say, making a mapping application and you
want a double click of the right mouse button to zoom out versus a
left double click zoom in.
 
L

Lee

Walton said:
I would be one of those people. If you're building a rich web app, I
can think of a few good reasons to disable the right mouse click. One
example would be if you want your own popup menu on rt click.
Another would be if you're, say, making a mapping application and you
want a double click of the right mouse button to zoom out versus a
left double click zoom in.

If you need that functionality, you should not be writing for browsers.
If you think of a cool application that involves using the turn indicator
on my car to adjust my seat position, keep that to yourself, too.


--
 
W

Walton

If you need that functionality, you should not be writing for browsers.

I couldn't disagree more. I'm not one to actually disable right click
on an entire page like this FAQ shows. But I think it can be
necessary to disable it in certain areas of a page. Look at Google
Maps for instance in Fx or IE. Try right clicking on their map, then
double right click it.

People are starting to want (free) applications, which are almost, if
not as functional as desktop apps. They can go on the internet and
fire one right up. Some people don't want to have to download any
plugins or other software or use up any hard drive space on their
computers.
If you think of a cool application that involves using the turn indicator
on my car to adjust my seat position, keep that to yourself, too.

Yeah, and you can keep your bad analogies to yourself, too.
 
R

Randy Webb

Walton said the following on 3/6/2007 11:31 AM:
I couldn't disagree more. I'm not one to actually disable right click
on an entire page like this FAQ shows.

That is the problem. If you can disable it for part of a page then you
can disable it for the entire page. And even though one person might
have a perfect scenario for doing it, it will get abused if allowed.
Witness popups and spammers/porn sites.
But I think it can be necessary to disable it in certain areas of a
page. Look at Google Maps for instance in Fx or IE. Try right clicking
on their map, then double right click it.

In the entire time I have used Google Maps I have never tried double
right clicking to zoom it. I just use my scroll wheel.

Try Google Maps in Opera....

Yeah, and you can keep your bad analogies to yourself, too.

Only thing is, it isn't a "bad analogy". It is spot on.
 
W

Walton

In the entire time I have used Google Maps I have never tried double
right clicking to zoom it. I just use my scroll wheel.

here we have a conflict of interest again. i hate when the scroll
wheel doesn't scroll the web page up and down and instead starts
zooming a map or doing something else unexpected. this is the same
kind of thing as disabling a right click. you're hijacking the
default action of a button for the sake of the application.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top