Can't read mouse from firefox

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
zacaj
Posts: 5
Joined: Wed Nov 20, 2019 7:28 am

Can't read mouse from firefox

Post by zacaj » Wed Nov 20, 2019 7:40 am

I'm trying to add 3d mouse support to my web app. On Chrome it works fine, but firefox is not detecting the 3d mouse as a gamepad.

ngomes
Moderator
Moderator
Posts: 2046
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Can't read mouse from firefox

Post by ngomes » Wed Nov 20, 2019 9:55 am

Hi zacaj,

What sort of web program? Is it a 3D visualisation program?

Similarly to your experience, we have also found Gamepad API to be lacking in terms of browser support and wider acceptance.

Sebastian_art
Posts: 5
Joined: Wed Mar 25, 2020 8:05 am

Re: Can't read mouse from firefox

Post by Sebastian_art » Wed Mar 25, 2020 8:29 am

[*]In Firefox, gamepads are only exposed to a page when the user interacts with one with the page visible. This helps prevent gamepads being used for fingerprinting the user. Once one gamepad has been interacted with, other gamepads that are connected will automatically be visible.

You can use gamepadconnected like this:

Code: Select all

window.addEventListener("gamepadconnected", function(e) {
  console.log("Gamepad connected at index %d: %s. %d buttons, %d axes.",
    e.gamepad.index, e.gamepad.id,
    e.gamepad.buttons.length, e.gamepad.axes.length);
});
Each gamepad has a unique ID associated with it, which is available on the event's gamepad property.

Post Reply