Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
The getVRDevices()
method returns a promise that resolves to an array of objects representing any VR devices that are connected to the computer and compatible with the browser.
There are two kinds of object that may be returned:
PositionSensorVRDevice
: A position sensor camera, which returns information such as head orientation and absolute position.HMDVRDevice
: A VR head mounted display.
Both inherit their basic structure and properties from the generic VRDevice
interface.
Syntax
navigator.getVRDevices();
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | (Yes)[1] | 39 (39)[2] | No support | No support | No support |
Feature | Android | Firefox Mobile (Gecko) | Firefox OS (Gecko) | IE Phone | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|
Basic support | No support | 39.0 (39)[2] 44.0 (44)[3] |
No support | No support | No support | No support | No support |
- [1] The support in Chrome is currently experimental. To find information on Chrome's WebVR implementation status including supporting builds, check out Bringing VR to Chrome by Brandon Jones.
- [2] The support for this feature is currently disabled by default in Firefox. To enable WebVR support in Firefox Nightly/Developer Edition, you can go to
about:config
and enable thedom.vr*
prefs. A better option however is to install the WebVR Enabler Add-on, which does this for you and sets up other necessary parts of the environment. - [3] The
dom.vr*
prefs are enabled by default at this point, in Nightly/Aurora editions.