W3cubDocs

/Web APIs

XRSession: enabledFeatures property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

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

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The XRSession interface's read-only enabledFeatures property returns an array of features enabled (granted) for an XRSession. This contains all requiredFeatures and a subset of optionalFeatures that have been requested with XRSystem.requestSession().

Value

An Array of strings.

Examples

>

Detecting available WebXR session features

The XRSystem.requestSession() method allows you to request XR session features. The features can be requested either as requiredFeatures (the XRSession must support the feature), or as optionalFeatures (the XRSession may support the feature). The enabledFeatures property identifies which features are actually available in the session.

navigator.xr
  .requestSession("immersive-ar", {
    requiredFeatures: ["local", "hit-test"],
    optionalFeatures: ["anchors"],
  })
  .then((xrSession) => {
    // Log enabledFeatures
    console.log(xrSession.enabledFeatures);

    // Check if anchors can be used
    if (xrSession.enabledFeatures.includes("anchors")) {
      // Go ahead and set up anchors
    }
  });

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet WebView Android WebView on iOS
enabledFeatures 111 111 No 97 No 111 No 75 No 22.0 No No

See also

© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/XRSession/enabledFeatures