Making Linux Firefox Ignore the Middle Mouse Button

This may sound kinda silly, but it's possible to make it so that the middle mouse doesn't do what it does in X - namely, paste whatever you selected.

The problem with Firefox is that, frequently, this means you'll be going to some random website. When you type random text into the URL bar, Firefox will run a Google "I'm Feeling Lucky" search on it - effectively taking you to whatever the first result is.

This is kinda cool, in that you can actually find the right website you want by doing this occasionally (try "news for nerds" some time), but if you've got something random selected (text you just deleted, some weird command), you'll wind up going someplace completely random.

So, here's how to make the middle mouse button act like it does under Windows.

Go to about:config in the address bar. (Might want to open a new tab for that.) No, I can't just link it, Firefox ignores "about:" URLs from webpages.

Now, filter on "middlemouse". Set "middlemouse.contentLoadURL" to false. (If you want to disable the middle mouse in text fields too, set "middlemouse.paste" to false too.) Note that middle clicking on tabs will now cause them to close, instead of having the text currently selected navigated to.

Since you've disabled pasting URLs into random pages, you may be interested in enabling autoscroll, which allows you to scroll the page by clicking the middle mouse button and moving the mouse up to scroll up and down to scroll down. This can be easily enabled in the Advanced section of the Preferences window, or you can filter on "autoscroll" in the "about:config" window and set "general.autoScroll" to true.

Topics: 

Comments

thank god!!! i can close my tabs with the middle mouse button like god intended!!!! way to be man!

Another thanks from this direction, too!

hey thanks a million for posting this !
get ready to be dugg :)

This helps! Thanx!

Thanks a bunch. This is great!

You my friend ARE DA MAN!!!!

I use an old fashioned 3 button mouse which I love because of the middle button autoscroll feature available in Windows and the middle click functionality in Firefox. I much prefer the autoscroll to a scroll wheel which I find very tiring to my fingers.

I have been getting my feet wet with Ubuntu. The one thing I absolutely missed the most was autoscroll, especially when web browsing. Scrolling using the side scroll bar I also find very tiring for my hand. As the lesser of two evils I connected an additional USB scroll mouse and placed it beside my regular mouse to scroll long web pages. That really wasn't very efficient and I found myself time after time out of habit hitting the middle mouse button and trying to autoscroll. It was so frustrating.

And now ... Nirvana. After following your directions and enabling autoscroll in Firefox, my first Linux autoscroll produced a feeling of pure joy at being liberated from scroll wheels and scroll bars while browsing! Thank you, thank you, thank you.

Now if I can just get the middle button autoscroll working in the rest of the GNOME environment I will be truly happy. If anybody knows how to do that please post.

This has been a most annoying action!
Mainly because I have heavy fingers :)
If you click both the right and left mouse buttons,
it's interpreted as a middle mouse click.
And Klipper just compounds the problem.
Thank goodness this is solved!!!

Just what I was looking for. Thanks a ton!

Alright, just what I needed. I was missing the auto scroll action since I use it at work all the time.

I just don't have the words to tell you how much I appreciate your help here.

I'm so happy I could almost cry =D

Thank you man. A big annoyance easily solved. Appreciate it!

Thanks for this tip!

I almost got gray hair on this as my wife clicked and ended up on a "naughty" page... Thanks again!

Thank you so much for that post!

Yeah, thanks a lot, right!

This is one of the best features of Xorg, and one of the most frustrating things I feel I am lacking when I am forced to use Windows. Why in the world would you ever want to disable it? You people are crazy...

It's more that using the "middle button paste" into the browser itself and not text fields is absolutely useless.

Generally I keep "middle paste" into text fields enabled because it is a very useful feature. However if you should be off by a few pixels when clicking on a text field, having the browser randomly search for whatever you were trying to paste and navigate away from your current page is extremely obnoxious.

Especially since "middle click" on links opens in new tabs, so being slightly off when clicking on a link also causes "navigate to random."

The browser itself should not be a paste area. Only text fields.