navigator.getVRDisplays() is a legacy WebVR method. MDN: it returns a Promise that resolves to an array of VRDisplay objects for available VR displays connected to the computer.
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call navigator.getVRDisplays. Start with this line.
JavaScript
navigator.getVRDisplays()
Call
What it does
navigator.getVRDisplays()
Primary signature.
navigator.getVRDisplays(...)
Call with the arguments your case needs.
Built into the browser. Call getVRDisplays(...) on a Navigator — no import required.
Library declarations
JavaScript
navigator.getVRDisplays()
Parameters
This member has no parameters beyond those shown in the signature.
Return Value
Return Value
Description
*
Promise → VRDisplay[]
JavaScript Examples
Example 1 — Feature-Detect First
Most modern browsers omit WebVR. Check before calling.
navigator.getVRDisplays() is Deprecated and Non-standard on MDN. It belonged to old WebVR and is missing in most modern browsers. Prefer navigator.xr or a maintained XR framework.
Bottom line: Do not ship new WebVR code. Feature-detect navigator.xr instead. See the MDN getVRDisplays() reference.
Frequently Asked Questions
MDN: it returns a Promise that resolves to an array of VRDisplay objects for available VR displays connected to the computer. It belonged to the old WebVR API.
Yes. MDN marks it Deprecated. WebVR development halted in favor of WebXR. Prefer navigator.xr or a maintained XR framework.
Yes. MDN also marks it Non-standard. WebVR never became a finished public web standard and was superseded by the WebXR Device API.
getVRDisplays() lists available VR displays. activeVRDisplays lists only displays that are currently presenting (isPresenting === true).
The WebXR Device API via navigator.xr (isSessionSupported / requestSession), or frameworks such as A-Frame, Three.js, or Babylon.js.
Usually the method is missing, or the Promise resolves to an empty array. That is expected without WebVR support and a headset.