• Skip to main content
  • Skip to search
  • Skip to select language
    • Technologies Overview
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • HTTP
    • APIs
    • Browser Extensions
    • MathML
    • Learn web development
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • Game development
    • ...more docs
    • Send Feedback
    • Contribute to MDN
    • Report a content issue 🌐
    • Report a platform issue 🌐
  1. Web technology for developers
  2. Web APIs
  3. Gamepad
  4. Gamepad.connected
  • Change language

Table of contents

  • Value
  • Examples
  • Value
  • Specifications
  • Browser compatibility
  • See also

Gamepad.connected

The Gamepad.connected property of the Gamepad interface returns a boolean indicating whether the gamepad is still connected to the system.

If the gamepad is connected, the value is true; if not, it is false.

Value

A boolean.

Examples

var gp = navigator.getGamepads()[0];
console.log(gp.connected);

Value

A boolean value.

Specifications

Specification
Gamepad
# dom-gamepad-connected

Browser compatibility

BCD tables only load in the browser

See also

Using the Gamepad API

Found a problem with this page?

  • Edit on GitHub
  • Source on GitHub
  • Report a problem with this content on GitHub
  • Want to fix the problem yourself? See our Contribution guide.

Last modified: Mar 29, 2022, by MDN contributors

Change your language

Related Topics

  1. Gamepad API
  2. Gamepad
  3. Properties
    1. axes
    2. buttons
    3. connected
    4. displayId
    5. hand
    6. hapticActuators
    7. id
    8. index
    9. mapping
    10. pose
    11. timestamp
    12. vibrationActuator
  4. Related pages for Gamepad API
    1. GamepadButton
    2. GamepadEvent
    3. Navigator.getGamepads()
    4. Window.ongamepadconnected
    5. Window.ongamepaddisconnected
  • Web Technologies
  • Learn Web Development
  • About MDN
  • Feedback
  • About
  • MDN Web Docs Store
  • Contact Us
  • Firefox

MDN

  • MDN on Twitter
  • MDN on Github

Mozilla

  • Mozilla on Twitter
  • Mozilla on Instagram

© 2005-2022 Mozilla and individual contributors. Content is available under these licenses.

  • Terms
  • Privacy
  • Cookies