# 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

- **Space:** xr-glasses-and-headsets-public (https://github.com/Tech-Realm/space-xr-glasses-and-headsets-public/tree/main/webxr-session-starter)
- **Level:** L1 (as the registry reports it)
- **Keys it needs (names only):** none
- **Tools:** python3, playwright-python, chromium
- **Routes:** static-local; checks: 1
- **Uses:** new (no recorded use yet)
- **Install:** `logicpacks pack use xr-glasses-and-headsets-public/webxr-session-starter` or MCP `get_pack xr-glasses-and-headsets-public/webxr-session-starter`
- **Files:** CHANGELOG.md, code/index.html, code/main.js, outcome/EVIDENCE.md, outcome/checks.yaml, outcome/results.json, pack.yaml, spec/SPEC.md, spec/source.md

## Purpose (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.



---

Canonical URL: https://logicpacks.io/packs/xr-glasses-and-headsets-public/webxr-session-starter

Developed by TechRealm (techrealm.online), the software team. Operated by Al Jash Trading (Establishment), Abu Dhabi, since 1994, the legal entity that hosts and is responsible for the service. Economic licence CN-1030597, Abu Dhabi Registration Authority. Address: Office 5, Bani Yas West 4, Bani Yas, Abu Dhabi, UAE. Website: https://aljashtrading.com. Contact: hello@logicpacks.io, security@logicpacks.io, WhatsApp +1 713 632 2262 (https://wa.me/17136322262).

Machine-readable index: [/llms.txt](/llms.txt). Plain facts: [/about.md](/about.md). Safety: [/safety.md](/safety.md).
