Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Mouse buttons 4 / 5 (Browser back / Browser forward) working in Firefox?

First, I need to say that I'm aware there is some confusion as to what button numbering scheme convention is used for these "Browser back" and "Browser forward" mouse buttons depending on whether you use numbering starting from zero 0 or one 1. Since this question is about Firefox, I'll go by Mozilla's numbering scheme here.

I've been struggling with an issue seen only in Firefox where Mouse buttons 4 (back) and 5 (forward) appear to Firefox as if they were a button 2 click (Middle button click) event. Pressing either button 4 or 5 results in the circular "autoscrolling" icon with Up and Down arrows appearing:

Firefox autoscroll icon

I've done some debugging using this Mouse Event Test Page. Results are different between Chrome and Firefox. It appears that the "which" JS event attribute numbers these as 4 and 5, while the button attribute numbers them as 3 and 4. Regardless, Google Chrome interprets them as "Browser back" and "Browser Forward" buttons correctly, while Firefox does not.

  • Chrome:

    • Mouse Button "4" (back)

      mousedown   which=4 button=3 buttons=8 mouseup     which=4 button=3 buttons=0 
    • Mouse Button "5" (forward)

      mousedown   which=5 button=4 buttons=16 mouseup     which=5 button=4 buttons=0 
    • Mouse Button "2" (middle click)

      mousedown   which=2 button=1 buttons=4 mouseup     which=2 button=1 buttons=0 
  • Firefox:

    • Mouse Button "4" (back)

      mousedown   which=2 button=1 buttons=8 mouseup     which=2 button=1 buttons=0 
    • Mouse Button "5" (forward)

      mousedown   which=2 button=1 buttons=16 mouseup     which=2 button=1 buttons=0 
    • Mouse Button "2" (middle click)

      mousedown   which=2 button=1 buttons=4 mouseup     which=2 button=1 buttons=0 

As the page says, not all browsers work correctly. It also states:

However, in some browsers, the defaults cannot be disabled, so various strange side effects may occur.

In Firefox, I notice clicking with all three of these buttons launches a new tab with javascript:void(null). This is the same as the link's URL attribute (href="javascript:void(null)"), as we can see from that page's source code. So this behavior is consistent with a Middle Button Click event, which usually will launch a new tab with that URL.

Is it possible to get these buttons for "Browser Back" and "Browser Forward" working properly in Firefox?

like image 279
TrinitronX Avatar asked Mar 27 '20 23:03

TrinitronX


People also ask

Why is the back button not working in Firefox?

Clear Browser Cache and Cookies If clicking or tapping the Back button doesn't do anything or causes the same page to reload, clearing it might help fix things.

Why are my side buttons not working mouse?

It is likely that either the mouse buttons are not recognized as individual buttons, or there is no default action assigned to these buttons. The solution depends on what program you are trying to use these buttons in. Operating System: Only mouse 1 and 2 (left click and right click) will have default actions assigned.


Video Answer


1 Answers

I can recommend the SensibleSideButtons project. It’s easy to install, and it will fix those mouse buttons in many other programs, too.

like image 177
Fabian Schmick Avatar answered Sep 28 '22 13:09

Fabian Schmick