navigator.activeVRDisplays comes from the old WebVR API. It returns every VRDisplay that is currently presenting. Learn what it returned, why it is deprecated, how to feature-detect it safely, and what to use instead with WebXR.
01
Kind
Read-only property
02
Returns
VRDisplay[]
03
Status
Deprecated · Experimental
04
Context
Secure (HTTPS)
05
API family
Old WebVR
06
Modern path
navigator.xr
Fundamentals
Introduction
The browser’s navigator object exposes information about the user agent and device capabilities. Years ago, WebVR added VR helpers on Navigator, including activeVRDisplays.
That property answered a simple question: which VR headsets are presenting right now? Only displays with VRDisplay.isPresenting === true appeared in the array.
⚠️
Deprecated & non-standard
MDN: do not use this in new code. WebVR was superseded by the WebXR Device API. Learn activeVRDisplays for legacy code and interviews, then migrate to navigator.xr.
This tutorial stays beginner-friendly: every example feature-detects first, so demos still make sense on laptops without a headset.
Concept
Understanding the activeVRDisplays Property
When supported, reading navigator.activeVRDisplays gives you an array of VRDisplay objects that are actively presenting immersive content.
It is read-only — you inspect, you do not assign.
An empty array means nothing is presenting (or you checked when VR was idle).
Missing property means the browser does not expose legacy WebVR here.
Requires a secure context (HTTPS / localhost) where it still exists.
Foundation
📝 Syntax
General form of the property:
JavaScript
navigator.activeVRDisplays
Value
An array of VRDisplay objects currently presenting.
Often empty when no headset is in a presenting session.
Common patterns
JavaScript
// Always feature-detect first
if ("activeVRDisplays" in navigator) {
const displays = navigator.activeVRDisplays;
for (const display of displays) {
console.log("Display " + display.displayId + " is active.");
}
} else {
console.log("WebVR activeVRDisplays is not available.");
}
// Prefer WebXR for new work
if (navigator.xr) {
// Use navigator.xr.isSessionSupported / requestSession
}
Cheat Sheet
⚡ Quick Reference
Goal
Code
Read active displays
navigator.activeVRDisplays
Feature detect
"activeVRDisplays" in navigator
Count presenting
navigator.activeVRDisplays.length
Log each id
display.displayId
Secure context?
window.isSecureContext
Modern VR/AR
navigator.xr (WebXR)
Snapshot
🔍 At a Glance
Four facts to remember about activeVRDisplays.
Type
VRDisplay[]
Presenting only
Status
deprecated
Legacy WebVR
HTTPS
required
Secure context
Replace with
navigator.xr
WebXR API
Compare
📋 WebVR activeVRDisplays vs WebXR
WebVR (activeVRDisplays)
WebXR (navigator.xr)
Status
Deprecated / non-standard
Current platform API
Entry point
navigator.activeVRDisplays
navigator.xr
What you get
Presenting VRDisplay list
XRSystem → sessions
Start experience
Legacy VRDisplay requestPresent
requestSession("immersive-vr")
New projects
Avoid
Prefer (or use a framework)
Hands-On
Examples Gallery
Examples follow MDN Navigator.activeVRDisplays patterns, plus safe detection and WebXR guidance. Use View Output or Try It Yourself for each case.
📚 Getting Started
Detect support and list presenting displays when available.
Example 1 — Feature Detection
Check whether the property exists before reading it.
JavaScript
const supported = "activeVRDisplays" in navigator;
console.log(supported ? "activeVRDisplays available" : "activeVRDisplays missing");
// Typical modern desktop: activeVRDisplays missing
isSecureContext: true
activeVRDisplays: absent
(exact lines depend on your browser / page URL)
How It Works
Even on HTTPS, modern browsers may omit the deprecated property. Secure context is necessary but not sufficient.
Example 5 — Prefer WebXR (navigator.xr)
For new code, detect WebXR instead of WebVR.
JavaScript
function describeVrApis() {
if (navigator.xr) {
return "Use WebXR via navigator.xr (recommended)";
}
if ("activeVRDisplays" in navigator) {
return "Only legacy WebVR activeVRDisplays found";
}
return "No WebXR or WebVR entry points detected";
}
console.log(describeVrApis());
navigator.activeVRDisplays belongs to the deprecated WebVR API. Support was never universal and has been removed or omitted in many modern browsers. Prefer navigator.xr (WebXR) for new work.
✓ Deprecated · Legacy WebVR
Navigator.activeVRDisplays
Do not rely on this property for new VR/AR products. Use it only to understand or migrate legacy code.
LegacyNot for new apps
Google ChromeLegacy WebVR removed / omitted in modern versions
Avoid
Mozilla FirefoxWebVR path deprecated; prefer WebXR where available
Avoid
Apple SafariNo practical WebVR activeVRDisplays path
Unavailable
Microsoft EdgeChromium Edge: treat as unavailable for new code
Avoid
OperaFollow Chromium WebVR/WebXR status
Avoid
Internet ExplorerNo WebVR activeVRDisplays support
Unavailable
activeVRDisplaysDeprecated
Bottom line: Feature-detect if you must touch legacy WebVR. For new immersive experiences, use WebXR (navigator.xr) or a maintained framework.
Wrap Up
Conclusion
navigator.activeVRDisplays once listed presenting WebVR displays. Today it is a deprecated legacy detail: feature-detect if you maintain old code, otherwise move to navigator.xr and modern WebXR patterns.
Legacy WebVR list of presenting displays — prefer WebXR now.
5
Core concepts
👓01
Returns
VRDisplay[]
Value
🔁02
Filter
isPresenting
Rule
⚠️03
Status
deprecated
Legacy
🔒04
HTTPS
secure context
Security
🚀05
Replace
navigator.xr
WebXR
❓ Frequently Asked Questions
It is a read-only Navigator property from the old WebVR API. It returns an array of VRDisplay objects that are currently presenting (VRDisplay.isPresenting is true).
No. MDN marks it deprecated and non-standard. Prefer the WebXR Device API via navigator.xr for new VR/AR work, or a framework like A-Frame, Three.js, or Babylon.js.
Either no VR display is presenting right now, or the property exists but nothing is in an immersive presenting state. On most modern browsers without WebVR, the property may be missing entirely.
Yes in supporting browsers: it is available only in secure contexts (HTTPS or localhost).
The WebXR Device API. Start with navigator.xr, then isSessionSupported() and requestSession() for immersive-vr or other modes.
No. It is read-only. You inspect presenting displays; you do not assign to the property.
Did you know?
WebVR and WebXR are different generations. Seeing activeVRDisplays in old samples is a clue you are looking at WebVR. New samples talk about XRSession and navigator.xr.requestSession() instead.