naTmeg / ScriptedAmigaEmulator

Amiga Emulator in javascript and HTML5
331 stars 63 forks source link

javascript Gamepad API needs a "secure context" #37

Closed goldnchild closed 2 years ago

goldnchild commented 2 years ago

Hi,

I just wanted to mention how cool it is that SAE supports the Gamepad API for joystick support, but it seems to be not working on http://scriptedamigaemulator.net because it needs a "secure context".

If I load it into firefox on ubuntu, the gamepad api is missing because it's http:// instead of the "secure" https://.

Chromium on ubuntu is a little more forgiving, it still works but it puts a message on the javascript console:

"getGamepad will now require Secure Context. Please update your application accordingly. For more information see https://github.com/w3c/gamepad/pull/120 initGamepads @ index.js:2815"

===================

According to https://hacks.mozilla.org/2020/07/securing-gamepad-api/ it says:

25 of August 2020 (Firefox 81 Beta/Developer Edition): .getGamepads() method will only return game pads if called in a “secure context” (e.g., https://).

if I load http://scriptedamigaemulator.net into firefox and bring up the F12 javascript console: it says that navigator.getGamepads is undefined:

navigator.getGamepads undefined

naTmeg commented 2 years ago

I've enabled HTTPS. It should fix this issue. Thanks for the report!