# Accessing navigator.xr in TypeScript

**URL:** <https://forum.babylonjs.com/t/accessing-navigator-xr-in-typescript/20657>\
**Category:** Questions\
**Created:** [May 7, 2021, 6:20pm UTC](https://forum.babylonjs.com/t/accessing-navigator-xr-in-typescript/20657 "2021-05-07T18:20:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdurnin](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rdurnin/32/11381_2.png) [@rdurnin](https://forum.babylonjs.com/u/rdurnin)\
**Post date:** [May 7, 2021, 6:20pm UTC](https://forum.babylonjs.com/t/accessing-navigator-xr-in-typescript/20657/1 "2021-05-07T18:20:41Z")

</div>

Hello, and pardon me if this is a peripheral question. I have been trying to detect xr in the browser without invoking a new session, and I have been unable to make use of custom types in a way that allows me to extend the interface.

The code in webXRSessionManager is accessing the property, and I have found a @types/webxr module which seems related to the Babylon work, but the modules will import and not compile.

Thanks, and I appreciate any advice you might have,  
Robert

---

<div class="post-metadata">

**Author:** ![PirateJC](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/piratejc/32/1003_2.png) [@PirateJC](https://forum.babylonjs.com/u/PirateJC)\
**Post date:** [May 7, 2021, 6:37pm UTC](https://forum.babylonjs.com/t/accessing-navigator-xr-in-typescript/20657/2 "2021-05-07T18:37:53Z")

</div>

Adding @RaananW the WebXR master for guidance.

---

<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:** [May 10, 2021, 9:44am UTC](https://forum.babylonjs.com/t/accessing-navigator-xr-in-typescript/20657/3 "2021-05-10T09:44:42Z")

</div>

hey!

@types/webxr is actually partly maintained by us! there might have been a change the I didn’t follow, but what seems to be the issue with compiling? Is it something we are doing?  
[Babylon.js/webxr.d.ts at master · BabylonJS/Babylon.js (github.com)](https://github.com/BabylonJS/Babylon.js/blob/master/src/LibDeclarations/webxr.d.ts)  
BTW - we have our own webxr typings file, which you can probably use as well -

---

<div class="post-metadata">

**Author:** ![rdurnin](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rdurnin/32/11381_2.png) [@rdurnin](https://forum.babylonjs.com/u/rdurnin)\
**Post date:** [May 10, 2021, 2:35pm UTC](https://forum.babylonjs.com/t/accessing-navigator-xr-in-typescript/20657/4 "2021-05-10T14:35:47Z")

</div>

Hey, and thanks for chiming in…

I have been trying to use the webxr typings file (npm i --save-dev @node/types | @types/webxr) in a node module (import “@types/webxr”;), but the navigator continues to complain that xr does not exist.

Is there a similarly simple way to check for the presence of xr within Babylon? (which does not require me to create a WebXRExperienceHelper)

r

---

<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:** [May 10, 2021, 2:42pm UTC](https://forum.babylonjs.com/t/accessing-navigator-xr-in-typescript/20657/5 "2021-05-10T14:42:36Z")

</div>

You can check `IsSessionSupportedAsync` from `WebXRSessionManager` which will resolve to false if xr is not available or if the session is, well, not supported
