Monday, January 2, 2023
HomeProgrammingDetect XR Help with JavaScript

Detect XR Help with JavaScript


Just a few years in the past I wrote an article about the best way to detect VR assist with JavaScript. Since that point, a complete lot has modified. “Augmented actuality” grew to become a factor and terminology has moved to “XR”, as an alternative 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 gadgets:

const supportsXR = 'xr' in window.navigator;

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


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments