MDN wants to learn about developers like you: https://qsurvey.mozilla.com/s3/MDN-survey

VRDevice.hardwareUnitId

Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The hardwareUnitId read-only property of the VRDevice interface returns the distinct hardware ID for the overall hardware unit that this VRDevice is a part of. All devices that are part of the same physical piece of hardware will have the same hardwareUnitId.

Syntax

var hardwareID = VRDevice.hardwareUnitId;

Value

A DOMString containing the ID of the overall hardware unit.

Examples

The following snippet (see our VRDevice example) returns an array of all the VRDevices connected to your computer via Navigator.getVRDevices(). For each connected device it then prints out the hardwareUnitId, VRDevice.deviceId, and VRDevice.deviceName.

var list = document.querySelector('ul');
var info = document.querySelector('p');
if(navigator.getVRDevices) {
  navigator.getVRDevices().then(function(myDevices) {
    reportDevices(myDevices);     
  });
} else {
  info.textContent = 'WebVR API not supported by this browser.'
}

function reportDevices(devices) {
  for(i = 0; i < devices.length; i++) {
    var listItem = document.createElement('li');
    listItem.innerHTML = 'Device ' + (i+1)
                 + ': <strong>Hardware ID</strong>: ' + devices[i].hardwareUnitId
                 + ', <strong>VD Device ID</strong>: ' + devices[i].deviceId
                 + ', <strong>VR Device Name</strong>: ' + devices[i].deviceName
                 + '.';
    list.appendChild(listItem);
  }
}

Specifications

Specification Status Comment
Unknown
The definition of 'hardwareUnitId' in that specification.
Unknown Initial definition

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support No No No No ? ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidIE mobileOpera AndroidiOS Safari
Basic support No No No ? No ? ?

See also

Document Tags and Contributors

 Contributors to this page: fscholz, chrisdavidmills, Sebastianz
 Last updated by: fscholz,