window.addEventListener("gamepadconnected", () => {
const gp = navigator.getGamepads()[0];
gamepadInfo.textContent = `Gamepad connected at index ${gp.index}: ${gp.id}.`;
});Gamepad: id property / notebook
Gamepad: id property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.