Page 1 of 1
Disabling the middle mouse button quickscroll feature.
Posted: Sat Aug 29, 2009 4:05 am
by JellyFish
Most browsers have a feature that when you press the middle mouse button down you go into this scrolling mode where you move/drag your mouse around to scroll in the direction you want. I want figure out a way with javascript to disable this feature for an entire document/page.
If anyone knows how to do this already, please let me know. I'll be updating this post with my progress on this.
Re: Disabling the middle mouse button quickscroll feature.
Posted: Sat Aug 29, 2009 6:41 am
by JAB Creations
I'm pretty sure you're talking about auto-scroll. I am also pretty sure this is not something you can control with JavaScript though if you can that would be very interesting!
The closest relating bit of knowledge I can share that you may be remotely interested in is that
overflow elements don't work with auto-scroll in Gecko browsers.
Re: Disabling the middle mouse button quickscroll feature.
Posted: Sat Aug 29, 2009 6:54 am
by JellyFish
Look what I found which is kinda interesting:
http://unixpapa.com/js/mouse.html. It's a ways down that page.
Re: Disabling the middle mouse button quickscroll feature.
Posted: Sat Aug 29, 2009 7:15 am
by JAB Creations
The page doesn't contain the word 'auto' and only makes vague references to the middle mouse button. You could emulate it somehow...though disabling it altogether is more of a user option in the OS versus something you could disable via JavaScript. The question that pops in to my head is why would you want to disable someone else's functionality? I can understand disabling the spacebar as pagedown when you hit a button on a form (that may not actually execute an action that loads another page and then loses focus of where you were) though I frankly can't think of any undesirable situations for auto-scroll.
Re: Disabling the middle mouse button quickscroll feature.
Posted: Sat Aug 29, 2009 11:44 am
by JellyFish
I'd like to take control of the middle mouse button for the same reason why all of the browser take control of the middle mouse button. They wouldn't say "Why would you take control of the middle moues but from the OS", if the OS had a user for the middle mouse button. Just like how the OS should be the platform for which application can be built, the web browser should be the platform for which web applications can be built.
If you where making a web application with a none scrollable interface, you wouldn't really need auto-scroll, would you? What does auto-scroll do for an application like meebo.com? Yes you could have auto-scroll for scrollbars within your web windows, but you wouldn't need it for the outer-most containing element, such as the body.
Also, on that page, under "Identifying Mouse Buttons", there would be a link saying "Click here with various mouse buttons to test". Try clicking that an notice how the middle mouse button is worked around.
Re: Disabling the middle mouse button quickscroll feature.
Posted: Sat Aug 29, 2009 4:40 pm
by JAB Creations
What I'm asking is what inherently breaks the page because of auto-scroll? Is the user losing focus or sight of the focused area of the page? Is the page being redirected or content loaded that clearly was not intended as so? I'm not seeing the need to disable the feature. Furthermore not everyone will necessarily have the middle mouse button set to autoscroll. I have a button set to it though with a scrollwheel mouse usually the wheel counts as the middle button. There are scripts to disable the right mouse button...there may be a script to disable the middle mouse button though I'm not sure.
I will whole-heartedly agree that sometimes the default actions and GUI are not in the user's best interest...in fact pretty much all the time in most regards. However you haven't presented an actual need, simply a desire. Something that may relate...my entire site would scroll with auto-scroll even though the body had no height. I set to 100% height because Safari 2 and Firefox 1.5 don't correctly set the background-color but then noticed the scrolling of the page itself. I dropped the height to 99.9% and the page no longer scrolled while the older browsers no longer had any problems with scrolling.
Re: Disabling the middle mouse button quickscroll feature.
Posted: Thu Sep 03, 2009 3:59 pm
by JellyFish
But I have presented an actual need. I mentioned, if you were building a web application such as one like Meebo, you wouldn't need the auto-scroll feature and in fact would probably want to user the middle mouse button for something else.
But the truth is, I'm not building a web application, I'm building a bookmarklet. I am simply experimenting with the idea of extending the web browser via bookmarklets (eventually I could port these bookmarklets to something like greasemonky).
So the reason I need to disable the auto-scroll feature is because I'd like to replace it's functionality with an alternative concept for scrolling in the web browser. Keep in mind that this is just an experiment. I would like to play around with the idea of alternate scrolling.
I know you might be thinking, why reinvent the wheel? I would say, "I have good idea for the wheel btw." If I want to attempt reinvent the wheel could I not have the freedom to do so?

Re: Disabling the middle mouse button quickscroll feature.
Posted: Thu Sep 03, 2009 4:10 pm
by Eran
Re: Disabling the middle mouse button quickscroll feature.
Posted: Thu Sep 03, 2009 4:27 pm
by JAB Creations
...and pytrin scores!
All the info you need is in that link...and remember that IE thinks your apple is an orange.

Re: Disabling the middle mouse button quickscroll feature.
Posted: Fri Sep 04, 2009 2:56 am
by JellyFish
I don't see how the link describes how to disable the auto-scroll feature of browsers. I know that to detect which mouse button has been pressed you would use the Event.button property. But how, within a mouse event, do you keep the event from continuing to carry on it's usual routine or activating auto-scroll mode? I tried return false, Event.preventDefaults(), and Event.stopPropagation(). None of which I could get to work.
Re: Disabling the middle mouse button quickscroll feature.
Posted: Fri Sep 04, 2009 6:00 am
by Eran
you have a typo there, it should be Event.preventDefault() (without the 's'). that should do it if you've caught the right event - test with alert() when you click the middle button (seeing some code would be helpful)