WebXR requirements
Stay organized with collections
Save and categorize content based on your preferences.
To setup an environment capable of AR development using WebXR, you'll need:
Use a secure context
A secure context 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 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. 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:
- Follow the steps for Set up port forwarding in the Chrome DevTools instructions.
- Ensure that the web server on the development workstation is running.
- 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.
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 in a compatible browser.
Next steps
Now that you have set up your development environment to create AR experiences using WebXR, you can:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[null,null,["Last updated 2024-10-31 UTC."],[[["\u003cp\u003eWebXR AR development requires a secure context (HTTPS, localhost, or *.localhost), a compatible browser, and an ARCore supported device.\u003c/p\u003e\n"],["\u003cp\u003ePort forwarding through Chrome DevTools can be used to establish a secure context if a TLS-enabled server is unavailable.\u003c/p\u003e\n"],["\u003cp\u003eAR experiences on Android are limited to ARCore supported devices with Google Play Services for AR installed and enabled.\u003c/p\u003e\n"],["\u003cp\u003eTo verify device and browser compatibility, visit a sample WebXR page like the one linked in the document.\u003c/p\u003e\n"],["\u003cp\u003eAfter setup, you can proceed to create immersive AR sessions and explore further using provided resources.\u003c/p\u003e\n"]]],["To enable WebXR AR development, use a web server in a secure context, either via TLS (`https://`) or `localhost`. If TLS is unavailable, use Chrome DevTools' port forwarding to map a port on your development machine to your Android device, ensuring the server is running. Confirm your Android device is ARCore-supported with Google Play Services for AR. Verify the setup by browsing to a sample WebXR page using a compatible browser.\n"],null,["# WebXR requirements\n\nTo setup an environment capable of AR development using WebXR, you'll need:\n\n- A web server that serves resources in a [secure context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts)\n- A [WebXR compatible browser](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API#browser_compatibility) on an [ARCore supported device](/ar/devices)\n\n | **Note:** Android Emulator is not yet supported by WebXR.\n\nUse a secure context\n--------------------\n\nA [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.\nYou'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.\n\nIn other to qualify as being served in a secure context, your resource must meet at least one of the following conditions:\n\n- The resource must be delivered over TLS (`https://`)\n- The resource must be requested through `localhost` or `*.localhost`.\n\n### Set up port forwarding\n\nIf 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.\n\nFollow these steps to set up port forwarding:\n\n1. 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).\n2. Ensure that the web server on the development workstation is running.\n3. 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`.\n\nThe 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.\n\nSet up a supported device\n-------------------------\n\nAR experiences on Android can only be run on an [ARCore supported device](https://developers.google.com/ar/devices).\nEnsure that the device has **Google Play Services for AR** installed and enabled.\n\nTo 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).\n\nNext steps\n----------\n\nNow that you have set up your development environment to create AR experiences using WebXR, you can:\n\n- Learn how to [create an immersive AR session using WebXR](/ar/develop/webxr/hello-webxr).\n- Try [WebXR Samples](https://immersive-web.github.io/webxr-samples/)."]]