0

Trying to implement HTML5 gamepad api using the following code:

window.addEventListener("gamepadconnected", function(e) {
    console.log(e.gamepad);
});

I have my wireless Xbox 360 controller connected. When I load my webpage, nothing shows up in the console. However, when I switch tabs and come back to the page, the console log appears. The same exact thing happens with this site. I load the site, it's blank, then I switch tabs and come back to it and there's information about my pad on the screen.

Chrome Version: 54.0.2840.71 (Official Build) m (64-bit)

Carpetfizz
  • 8,707
  • 22
  • 85
  • 146
  • 1
    I've read that in some cases the gamepad has to be interacted with before the browser will detect it, could possibly be the real problem coinciding with changing tabs somehow? – MattTreichel Dec 22 '16 at 17:10
  • Yes, this is true! We ended up figuring that out and were able to test our app despite the minor annoyance. Other than that, the gamepad api is very easy to use :) – Carpetfizz Dec 23 '16 at 20:33

0 Answers0