Reprise: The Gamepad API works in Chrome but not in Firefox?

Admins: Please move if necessary but I could not determine a better category for this question/issue.

Ref: My original posting located at

Note the current posting is several updates to Firefox and Chrome later and my current version of Firefox is 95.0.2 (64-bit) as of the date of this posting.

Also note that I am doing development of a joystick-based FPV robot using the GoPiGo3 robot produced by Dexter Industries/Modular Robotics

. . . by connecting to a web server running directly on the robot itself.

The problem I am experiencing is that when I try to instantiate the gamepad object via an event listener:

      window.addEventListener("gamepadconnected", (event) => {
        gamepad_connected();  // Gamepad is now connected
        send_data(gopigo3_joystick)  // send it to the robot
        get_more_data();  // continue service loop


      function  get_gamepad_data() {
        js = (navigator.getGamepads && navigator.getGamepads()) || (navigator.webkitGetGamepads && navigator.webkitGetGamepads());

. . . the developer console in Firefox returns  js is undefined.

Neither Chrome, (on this same Windows laptop) nor Chromium (on my robot), have this problem and the joystick project works.  (Not particularly well just yet, as there is still work to be done.  :wink:  But, it DOES work on those two browsers.)

I suspect, though cannot prove, that the reason for this is that the web site for this project is being served directly off the robot itself (using Python, flask, and werkzug) and is not a secure site. (I access it by entering the robot’s IP address on my local network.)

Additionally, these robots are used for educational purposes in schools, and to make things easier they start up as their own “access point” that you connect to, open the robots page, (on localhost), and then access the robot’s features.

I realize that all this is because various malware writers want to make our lives difficult - and folks like the people at Mozilla are working hard to prevent this.


  1. Is it possible to disable this somehow - at least for development purposes - so that I can verify that it is the absence of a secure site that is causing the problem?

  2. Is there something I can do, server side, (like a special header or something), that will tell the browser that it’s OK to access a gamepad on my local network, or via the robot’s access point?

  3. I also suspect that, eventually, there will need to be some kind of self-signed certificate for the robot.  To add to the complexity of the issue, these robots - especially if they are used in class as access-points - get renamed so that individual robots in a class can be distinguished from each other.

    • Do you have any ideas or suggestions on how to set up this kind of self-signed certificate?

Thanks in advance for any help or advice you can provide.

Yes, the Gamepad API in Firefox is only available in secure contexts, so you’d need to have HTTPS. This is according to specification.

See also the related issue for the spec here:

1 Like