The <geolocation> element lands in Chrome 144
I wired up a scratch page with the new <geolocation> element the morning I read the writeup, and the surprise is how small the markup gets. What used to be a navigator.geolocation.getCurrentPosition(...) dance is now a handful of attributes on a single tag. Per the Piccalilli writeup, <geolocation> ships in Chrome 144+. The element began life as a general-purpose <permission> element and was…
The geolocation element debuted in Chrome version 144, offering a streamlined alternative to the older Geolocation JavaScript API. This new HTML element consolidates the former process of requesting location data into a single tag with three key attributes: accuracy mode, autolocate, and watch. Developers can also attach a listener using the onlocation attribute.
The element exposes properties like isValid, initialPermissionStatus, position, and error for reading coordinates, and emits events such as validationstatuschange, promptaction, promptdismiss, and location. A notable addition is the :granted CSS pseudo-class, which indicates the granted permission state, allowing developers to style fallback UI with CSS alone.
Progressive enhancement is emphasized, where a fallback button is placed within the geolocation tags, rendering differently based on browser support. The element is currently supported in Chrome 144+, but its compatibility with other engines remains unclear. Developers are advised to maintain fallbacks and use feature-detection before relying on the new element's features.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.