# WebXR requirements

To setup an environment capable of AR development using WebXR, you'll need:

- A web server that serves resources in a [secure context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts)
- A [WebXR compatible browser](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API#browser_compatibility) on an [ARCore supported device](https://developers.google.com/ar/devices)

  > [!NOTE]
  > **Note:** Android Emulator is not yet supported by WebXR.

## Use a secure context

A [secure context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts) is a security mechanism that ensures that web resources have been transferred with a certain level of security.
You'll need a secure context to provide a [trusted XR experience](https://www.chromium.org/Home/chromium-security/prefer-secure-origins-for-powerful-new-features) with your new features.

In other to qualify as being served in a secure context, your resource must meet at least one of the following conditions:

- The resource must be delivered over TLS (`https://`)
- The resource must be requested through `localhost` or `*.localhost`.

### Set up port forwarding

If you don't have a development server accessible over TLS, you can still develop in a secure context by using Chrome DevTools' [Port forwarding](https://developers.google.com/web/tools/chrome-devtools/remote-debugging/local-server). Port forwarding enables an Android device to access content hosted on the development machine's web server. It creates a listening TCP port on the Android device that maps to a TCP port on the development machine. Traffic can then travel through the USB connection between these two ports.

Follow these steps to set up port forwarding:

1. Follow the steps for **Set up port forwarding** in the [Chrome DevTools instructions](https://developers.google.com/web/tools/chrome-devtools/remote-debugging/local-server).
2. Ensure that the web server on the development workstation is running.
3. Verify that your connection works. Open Google Chrome on the Android device and browse to `localhost` on the port number specified in *Port forwarding settings* , for example, `localhost:8000`.

The resources on the web server should now be visible from the Android device. These resources are served in a Secure Context and can use WebXR capabilities.

## Set up a supported device

AR experiences on Android can only be run on an [ARCore supported device](https://developers.google.com/ar/devices).
Ensure that the device has **Google Play Services for AR** installed and enabled.

To verify that the device is correctly configured to run WebXR, browse to [a sample WebXR page](https://immersive-web.github.io/webxr-samples/immersive-ar-session.html) in [a compatible browser](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API#browser_compatibility).

## Next steps

Now that you have set up your development environment to create AR experiences using WebXR, you can:

- Learn how to [create an immersive AR session using WebXR](https://developers.google.com/ar/develop/webxr/hello-webxr).
- Try [WebXR Samples](https://immersive-web.github.io/webxr-samples/).