Skip to content

Packs / xr-glasses-and-headsets-public

webxr-session-starter

Start an immersive WebXR VR or AR session from a button with feature detection, and fall back to an inline 3D view when XR is unavailable

Install

logicpacks pack use xr-glasses-and-headsets-public/webxr-session-starter
get_pack xr-glasses-and-headsets-public/webxr-session-starter

The second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.

Keys it needs (names only)

None.

Playbooks included

  • Spec: spec/SPEC.md (goal, steps, edge cases, don’ts)
  • Routes: static-local
  • Checks: 1 in outcome/checks.yaml
  • Code: index.htmlmain.js
  • Tools: python3, playwright-python, chromium

Usage, last 8 weeks

New: no recorded use yet.

Purpose (from spec/SPEC.md)

Goal

One page that works everywhere: on a headset it offers Enter VR / Enter AR (only for supported modes), elsewhere it renders the same scene inline with no errors.

Steps

  1. Copy code/ and serve over HTTPS (WebXR needs a secure context; localhost is allowed for development).
  2. The page asks navigator.xr.isSessionSupported() for immersive-vr and immersive-ar and only shows buttons for supported modes.
  3. Sessions start from a click (user activation) with local-floor reference space and hand-tracking as an optional feature.
  4. On session end the inline loop resumes.
  5. Check: python3 ../tools/webgl_check.py code --js "window.__xr.mode === 'inline'".
  6. On a headset: open the page in Quest Browser / Vision Pro Safari and enter VR (rubric).

Edge cases

  • Vision Pro Safari: immersive-vr only (no immersive-ar for web pages at the time of writing).
  • Quest Browser supports immersive-ar (passthrough).
  • Reference space local-floor can be missing: the template falls back to local.

Don'ts

  • Don't request a session on page load (it is rejected without a user gesture).
  • Don't make features required unless the experience cannot work without them.