...

View Full Version : Disable middle click button



DDLAuLau
03-15-2012, 11:10 AM
Hi guys,

At the moment i have this code which disable the middle button in Safari and Chrome..



$('body').mousedown(function(e){
if(e.button==1)
return false
}
);

How can I disable it in Firefox and IE?.. i think IE middle button ==4 but its not working for me.

Thanks in advance!

Philip M
03-15-2012, 01:19 PM
http://unixpapa.com/js/mouse.html

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

webdev1958
03-15-2012, 01:37 PM
How critical is it that you be able to disable the middle mouse button?

If not at all, then I wouldn't bother.

1) If javascript is turned off or not available in the user's browser then your javascript will not work anyway.

2) Users can configure the mouse button to do things other than what you expect and if you disable those functions then you run a high risk of losing that visitor.

Why do you want to disable the middle button? There might be better alternatives.

felgall
03-15-2012, 07:24 PM
The middle mouse button is the one people are most likely to configure to perform the action they want to make most convenient to use since it is the one they would otherwise be least likely to use.

It will do different things in different browsers even if they don't change it. What you are trying to do is the equivalent of telling people around the world not to catch a number 10 bus because your local 10 bus goes somewhere you don't want them to go.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum