Thursday, April 18, 2024
HomeJavaScriptDetect XR Help with JavaScript

Detect XR Help with JavaScript


A couple of years in the past I wrote an article about find out how to detect VR assist with JavaScript. Since that point, a complete lot has modified. “Augmented actuality” turned a factor and terminology has moved to “XR”, as a substitute of VR or AR. As such, the API has wanted to evolve.

The presence of navigator.xr alerts that the browser helps the WebXR API and XR units:

const supportsXR = 'xr' in window.navigator;

I actually like utilizing in for function checking fairly than if(navigator.xr), as merely invoking that would trigger some initialization to happen. In future posts we’ll discover figuring out and connecting to completely different units.


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments