WebXR
The browser API that lets a web scene enter a VR headset or place AR objects through a camera, with head and controller tracking.
See it
What it is
WebXR is the browser API that connects a web scene to virtual-reality and augmented-reality hardware. An XRSession supplies a pose and a view for each eye every frame, plus input from tracked controllers or screens. Reference spaces keep the scene anchored to the viewer, the floor, or a local origin. It replaced the older WebVR API.
Reach for it when a 3D experience should open in a headset or place content into the camera view of a supported phone. Three.js, Babylon.js, and A-Frame wrap the low-level session and view setup, so most projects use one of them rather than building stereo rendering directly. In practice most sessions run in the Meta Quest browser, or in Chrome on Android for handheld AR. A regular 360-degree panorama does not need WebXR unless it must track a headset or accept immersive input.
Gotcha: immersive sessions require a secure context, compatible hardware, and a user action before requestSession() can start. Normal HTML controls do not automatically appear inside a headset, and optional features such as hand tracking or AR hit testing must be requested and may be unavailable. Keep a mouse, touch, or inline version so the page still works without XR.
Ask AI for it
Build an immersive VR product viewer with Three.js and WebXR. Set renderer.xr.enabled = true, add VRButton.createButton(renderer), and render with renderer.setAnimationLoop(). Load the product as GLB, place it at standing height in a local-floor reference space, and use renderer.xr.getController() to add ray-based selection from both controllers. Show hover and selected states on the mesh, stop the XRSession cleanly, and retain orbit controls as the non-XR fallback.