# WebXR on Oculus Quest

**URL:** <https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949>\
**Category:** Questions\
**Created:** [August 6, 2019, 6:40am UTC](https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949 "2019-08-06T06:40:14Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![bengfarrell](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bengfarrell/32/1788_2.png) [@bengfarrell](https://forum.babylonjs.com/u/bengfarrell)\
**Post date:** [August 6, 2019, 6:40am UTC](https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949/1 "2019-08-06T06:40:14Z")

</div>

Thanks to some help on previous questions in this forum I was able to get a Babylon (preview) scene working in WebXR on Chrome Canary in the Rift. Awesome, yes…but of course I’m always going to want more.  
I totally understand that WebXR is a moving target right now, but I’m also seeing some older posts from this year with Babylon scenes working on the Quest.

Is this because those folks targeted WebVR with an older version of Babylon? If so, is it possible to swap out the default XR helper I’m using with an older VR helper (maybe using the same Babylon v4.1.0 a13)?

Ultimately, which is out of date? Is it that Babylon isn’t targeting the same WebXR as the Quest (both stock browser and FF Reality)? Or is it that those browsers are still on WebVR?

Despite all the questions, I’m psyched I can do this at all right now, anywhere - so THANKS!

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [August 6, 2019, 7:16am UTC](https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949/2 "2019-08-06T07:16:52Z")

</div>

> [@bengfarrell](#):
>
> Ultimately, which is out of date? Is it that Babylon isn’t targeting the same WebXR as the Quest (both stock browser and FF Reality)? Or is it that those browsers are still on WebVR?

Without digging too much, it seems to me like the browsers are not catching up. In this article - [Firefox Reality for Oculus Quest](https://blog.mozvr.com/firefox-reality-for-oculus-quest/) , firefox are saying that they are planning a WebXR rollout in “a few months” (the paragraph before last), so I assume the browser still supports the “older” WebVR specs. And Stock browsers are never truly updated.

I dont have a quest, so I can’t really test that, but a quick check will be to use an older stable version of Babylon (like the latest 3.x) and see if it works. If it does, it’s the browsers who implemented older specs. If it doesn’t, it must be us.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [August 6, 2019, 3:32pm UTC](https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949/3 "2019-08-06T15:32:26Z")

</div>

You can still use pure webVR (not XR) with the WebVRCamera (instead of WebXRCamera):  
[https://doc.babylonjs.com/how\_to/webvr\_camera](https://doc.babylonjs.com/how_to/webvr_camera)

---

<div class="post-metadata">

**Author:** ![bengfarrell](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bengfarrell/32/1788_2.png) [@bengfarrell](https://forum.babylonjs.com/u/bengfarrell)\
**Post date:** [August 6, 2019, 5:04pm UTC](https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949/4 "2019-08-06T17:04:28Z")

</div>

That’d be great - esp if I can use the same Babylon version and just set a flag in my code to switch off. I’ll check it out now that I have a bit of confidence it’ll work.

If it doesn’t I’ll try rolling back to 3.x as RaananW says.  
Thanks both!

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [August 6, 2019, 9:28pm UTC](https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949/5 "2019-08-06T21:28:48Z")

</div>

This should work with 4.1-a13 🙂

---

<div class="post-metadata">

**Author:** ![bengfarrell](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bengfarrell/32/1788_2.png) [@bengfarrell](https://forum.babylonjs.com/u/bengfarrell)\
**Post date:** [August 7, 2019, 2:18am UTC](https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949/6 "2019-08-07T02:18:18Z")

</div>

Indeed it does, thank you!

Just to contribute back if anyone is wondering - I have both WebXR and VR working - I check XR first, and if that mode isn’t available, I start the VR helper.

```
        // Check XR support
    const xrHelper = await scene.createDefaultXRExperienceAsync({floorMeshes: [environment.ground]});
    if(!await xrHelper.baseExperience.sessionManager.supportsSessionAsync("immersive-vr")){
        // do WebVR instead
        const vrHelper = scene.createDefaultVRExperience();
        vrHelper.enableInteractions();
    } else {
        // do some WebXR stuff
```

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [August 7, 2019, 2:00pm UTC](https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949/7 "2019-08-07T14:00:50Z")

</div>

Happy that it worked ;D

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [September 23, 2019, 5:33pm UTC](https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949/8 "2019-09-23T17:33:31Z")

</div>

Just wanted to update regarding webXR and the oculus quest  
The oculus quest browser does support webXR (if turned on) BUT!! a very old version. The “hack” to make it work (somehow) is to add this code to your main .js file (warning, global namespace manipulations!)

```javascript
// missing function?
f(navigator.xr && !navigator.xr.supportsSession) {
    navigator.xr.supportsSession = navigator.xr.supportsSessionMode;
    let originalRequestSession = navigator.xr.requestSession;
      // change signature
      navigator.xr.requestSession = function(mode, options) {
        return originalRequestSession.call(this, {mode: mode}, options).then((session) => {
          let requestReferenceSpace = session.requestReferenceSpace;
          // change signature
          session.requestReferenceSpace = function(type) {
              return requestReferenceSpace.call(this, {type: "identity"});
          }
          return session;
        });
      };
}

```

As you can see, most (if not all) of the webxr functions in the oculus browser (current version of the browser, i must say) have a different signature than what it is supposed to be. AND, the only mode it supports is identity (which is not even documented on MDN).  
So, long story short - i wouldn’t try using webxr on the oculus quest, until they update their browser with the newest API. then there is no reason for it to not work.

---

<div class="post-metadata">

**Author:** ![bengfarrell](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bengfarrell/32/1788_2.png) [@bengfarrell](https://forum.babylonjs.com/u/bengfarrell)\
**Post date:** [September 26, 2019, 3:01am UTC](https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949/9 "2019-09-26T03:01:21Z")

</div>

Awesome, thanks! Even if it is a bit of a hack, it seems cleaner than switching between WebVR and XR like I did.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [September 26, 2019, 12:25pm UTC](https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949/10 "2019-09-26T12:25:18Z")

</div>

Oh, and you can always use the webxr polyfill - [GitHub - immersive-web/webxr-polyfill: Use the WebXR Device API today, providing fallbacks to native WebVR 1.1 and Cardboard](https://github.com/immersive-web/webxr-polyfill) . I tested it with Edge, it seems to be stable enough to use. There was an issue with the tracking from time to time (single frames dropped) but i think it is related to the scene I was testing, as I was experimenting with practically everything I could 😉

A small hint, the CDN does NOT have the latest version, so if you really want to use this, download it and integrate it yourself.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 26, 2019, 3:43pm UTC](https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949/11 "2019-09-26T15:43:45Z")

</div>

The cdn for preview is [preview.babylonjs.com](http://preview.babylonjs.com)

---

<div class="post-metadata">

**Author:** ![bengfarrell](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bengfarrell/32/1788_2.png) [@bengfarrell](https://forum.babylonjs.com/u/bengfarrell)\
**Post date:** [September 26, 2019, 5:36pm UTC](https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949/12 "2019-09-26T17:36:27Z")

</div>

Awesome, thanks again! This is all perfect timing, I had a POC before that I was working on when I initially asked this question. Now I’m formalizing it a bit and redoing - so this latest advice will definitely influence

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [September 27, 2019, 8:14am UTC](https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949/13 "2019-09-27T08:14:21Z")

</div>

Oh, I meant the CDN for the polyfill on their github. I know babylon’s CDN is always updated 🙂

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 27, 2019, 2:48pm UTC](https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949/14 "2019-09-27T14:48:46Z")

</div>

Sorry I’m getting old 😉

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [September 27, 2019, 2:51pm UTC](https://forum.babylonjs.com/t/webxr-on-oculus-quest/4949/15 "2019-09-27T14:51:11Z")

</div>

Just like wine 🙂
