WebXR Support Detection

Hey there,

I am trying to gracefully fallback if AR support is not detected in a browser, but seem to be getting a false positive. Code is simple, and done per the doc here. It consists of trying to init an immerseive-AR session and wait to see if the baseExperience returns.

Sadly, Chrome for desktops is reporting AR support when it should not. I know that Chrome is shipping with XR support enabled (finally!) and I assume that may be part of the issue as it may only be looking for ANY XR support, not just AR specific. Firefox reports the correct state of no AR. What is the best options to do this correctly so that only AR capable devices, and not just devices capable of some form of XR set the AR support flag to true?

Here is a PG:

Hello!

Maybe you can check for some specific feature that only works on AR devices? Like plane detection: AR Feature Check | Babylon.js Playground (babylonjs.com)

1 Like

You can check if a specific session is supported:

AR Feature Check | Babylon.js Playground (babylonjs.com)

If you use the UI system the button won’t appear if the session is not supported. So you get the base experience helper which means that XR is present, but you have no way to enter the session (as the button is not displayed).

1 Like

Thanks both of you.

RaananW’s was the simplest and allows me to detect before trying to initialize XR, disabling console spam and the need to catch a failure.