How to stop middle click opening URL in Firefox

Not the “middle click opens link in a new tab feature”. I want that. If I middle-click not on a link, Firefox tries to open whatever is in my clipboard as a URL.

As an example, if I copy “wikipedia” and middle click somewhere, opens up.

Sometimes my wheel moves when I try to middle-click, and instead of a new tab of the link I was aiming at, another page opens in place of the one I’m looking at, which is a pain.

I have no idea whether this is a Firefox setting or a mouse setting, or what. How do I turn this off?

I’m on the most recent Linux Mint, Firefox 3.6.13, if it matters.

about:config, set middlemouse.contentLoadURL to false.

Wonderful! Thanks!

<Happily middle-clicking all over the page and nothing happens>

How about if I want to disable the mousewheel button altogether? Including in other applications, such as Thunderbird email. Will toggling off all the middlemouse parameters do that?

Everyone once in a while I’ll be scrolling with the mousewheel and accidently click the button. If it’s in a window where I’m composing an email, for example, it pastes whtever is in the clipboard right there. Which is never what I want to happen. Based on the name, I would guess that toggling off middlemouse.paste would stop this. What about toggling off the other two parameters?

You can do that for the whole system by disabling the detection of the mousewheel altogether in your mouse hardware driver.

Control Panel - System - Hardware - Device Manager - Mice & Pointing devices.

I forgot to mention that I’m running Linux. Can’t seem to find a control panel.

Besides which, I still want the mousewheel to work, I just don’t want the button to do anything.

Install imwheel and play with that for a bit.

How you install software is up to your distro. Are you running Ubuntu, Fedora, or something else?

Check your distribution’s documentation for how to do this through the configuration utility. If you can’t find it, then you can disable the middle button by directly editing your X Windows configuration files. On most modern systems this will be in /etc/X11/xorg.conf. If you see a line that looks something like this:

Option “Emulate3Buttons” “on”

then replace it with this:

Option “ButtonMapping” “1 1 3 4 5”

On most mice this will turn the middle button into a left button, so middle-click has the same effect as left-click. Or you could try the following:

Option “ButtonMapping” “1 0 3 4 5”

That might disable the middle button completely.

Note that you may need to restart your windowing environment for this to take effect. Depending on your system, this may be accomplished by logging out and back in again, or you may need to restart the whole machine.

Regardless of distribution, you can accomplish this with xmodmap with no restart required. Be aware that if you change xorg.conf, you’re changing the behavior for every user. You can use xmodmap to change the behavior for just yourself, which might be nice if more than one person uses the machine.

This is all true. But keep in mind that using xmodmap isn’t persistent – if you use that it will remap the mouse button only for the current session. If the OP wants it to be disabled permanently, he’ll either have to edit xorg.conf (which is fine for a single-user machine), or he’ll have to put the xmodmap command in some file which gets executed upon login.

I’m running Centos. I’m the only one who uses it, so I have no problems changing system parameters. I’m not sure what the config utility is for this. Googling says I should have a system-config-mouse utility, but I don’t seem to have it.

I checked the xorg.conf file and it doesn’t have a section for the mouse. I suppose I could add one, since the syntax seems simple enough. Something like this:

Section "InputDevice"
          Identifier     "Mouse0"
          Driver         "???"
          Option        "ButtonMapping" "1 0 3 4 5"

I’m not sure what to put in the “???” field and I suspect it needs more options, but I don’t what they would be. Also I’d need to add another InputDevice line in the ServiceLayout section, but that’s obvious. Any ideas on this?


Yes, the CentOS manual does mention that you should run this command from the terminal. What happens when you run it? Does it say “command not found”?

That’s highly unusual. Are you sure it’s not one of the existing InputDevice sections?

Usually “mouse” works for the Driver field, though it depends on your mouse model.

Really, your best bet is probably to get the system-config-mouse utility up and running. Find out where on your system it is, and if it’s not there, install it. I’ve never used CentOS, but this utility sounds like it may allow you to configure the action associated with the buttons, or if not, to fool your system into thinking it’s got a two-button mouse.

If none of this helps, you may have better luck posting this question on a forum dedicated to CentOS, such as the official forums, or maybe on a generic GNU/Linux one such as comp.linux.misc.

Yes. One thing is that I’m using Centos 5.3 and that manual is for an earlier version. Possibly they had to remove it for some reason in the latest version. Or perhaps I just didn’t install it when I installed the system.

I’m certain. The only InputDevice section is for the keyboard.

Yeah, I think I’d better. Thanks for the help.