Develop

Getting Started with WebXR PWAs

Updated: Jul 22, 2026

Overview

Before packaging your WebXR experience as a PWA, test it in the Browser. PWAs use the same rendering engine as Browser, so you can identify compatibility or performance issues before packaging.
You can find basic information about Browser, including the User Agent string, supported content sizes, and more in our Browser specifications guide. You can also connect the Chrome Developer Tools from your computer to a Meta Quest device for debugging and performance analysis using the Android Platform Tools.

Request a WebXR session after page load

WebXR PWAs should behave like native immersive apps in Meta Horizon OS, launching directly into immersive mode right after launch without a 2D landing page. To achieve this, call the requestSession API right after the page is loaded.

Three.js

Add a navigator.xr.requestSession call after the page initialization is finished.
For example, in init.js, at the end of the init function definition:
export async function init(setupScene = () => {}, onFrame = () => {}) {
  // Other setup code...
  if (
    window.getDigitalGoodsService === undefined ||
    !navigator.xr?.isSessionSupported
  ) {
    return;
  }

  const supported = await navigator.xr.isSessionSupported('immersive-vr');
  if (!supported) {
    return;
  }

  const session = await navigator.xr.requestSession('immersive-vr');
  await renderer.xr.setSession(session);
}

A-Frame

Add an event listener to the HTML file of your landing page.
For example:
<script type="text/javascript">
  if (window.getDigitalGoodsService !== undefined) {
    const scene = document.querySelector('a-scene');
    if (scene.hasLoaded) {
      scene.enterVR();
    } else {
      scene.addEventListener('renderstart', () => scene.enterVR(), {
        once: true,
      });
    }
  }
</script>

Next steps

After setting up and hosting your web app manifest, visit the PWA Packaging page to build your installable application.

Frequently asked questions

What are the user activation requirements for requestSession API?

The XRSystem:requestSession() method requires a user activation as a security check before a WebXR session can be created. This prevents the user from being brought into an immersive WebXR session right after a WebXR page is loaded in the regular browser. In the WebXR PWA scenario, clicking the PWA app icon is considered user action to create a WebXR session for PWAs. It provides the same user experience as other immersive apps in Meta Horizon OS.

Can I call requestSession after the page load only in a PWA?

Yes. Check if the Digital Goods service is available before calling requestSession to make sure you are within a PWA scope. The Three.js and A-Frame examples on this page include this check.

How to debug WebXR PWAs on Quest devices?

You can connect the Chrome Developer Tools from your computer to a Meta Quest device for debugging. You will be able to see your website tab being loaded in chrome://inspect after your WebXR PWA is launched. Click inspect to start debugging that tab in Browser.