Detect XR Support with JavaScript
A few years ago I wrote an article about how to detect VR support with JavaScript. Since that time, a whole lot has changed. “Augmented reality” became a thing and terminology has moved to “XR”, instead of VR or AR. As such, the API has needed to evolve.
The presence of navigator.xr
signals that the browser supports the WebXR API and XR devices:
const supportsXR = 'xr' in window.navigator;
I really like using in
for feature checking rather than if(navigator.xr)
, as simply invoking that could cause some initialization to take place. In future posts we’ll explore identifying and connecting to different devices.
CSS @supports
Feature detection via JavaScript is a client side best practice and for all the right reasons, but unfortunately that same functionality hasn’t been available within CSS. What we end up doing is repeating the same properties multiple times with each browser prefix. Yuck. Another thing we…
Camera and Video Control with HTML5
Client-side APIs on mobile and desktop devices are quickly providing the same APIs. Of course our mobile devices got access to some of these APIs first, but those APIs are slowly making their way to the desktop. One of those APIs is the getUserMedia API…
Duplicate the jQuery Homepage Tooltips
The jQuery homepage has a pretty suave tooltip-like effect as seen below: The amount of jQuery required to duplicate this effect is next to nothing; in fact, there’s more CSS than there is jQuery code! Let’s explore how we can duplicate jQuery’s tooltip effect. The HTML The overall…
[ad_2]
Source link