Gamepad: connected property
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.
Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.
TheGamepad.connected property of theGamepad interface returns a boolean indicating whether the gamepad isstill connected to the system.
If the gamepad is connected, the value istrue; if not, it isfalse.
In this article
Value
A boolean.
Examples
js
const gp = navigator.getGamepads()[0];console.log(gp.connected);Specifications
| Specification |
|---|
| Gamepad> # dom-gamepad-connected> |