Chrome 144 introduces declarative <geolocation> HTML element to replace JS API
Google Chrome 144 has shipped a new HTML <geolocation> element that replaces the verbose navigator.geolocation JavaScript API with a handful of declarative attributes. The element supports three key attributes — accuracymode, autolocate, and watch — along with an onlocation event handler for capturing coordinate updates. It exposes properties mirroring the existing Geolocation API, including position.coords and position.timestamp, while adding four new events, notably promptaction and promptdismiss, which give developers visibility into browser permission prompts for the first time. A new :granted CSS pseudo-class allows UI states tied to location permission to be expressed in CSS rather than JavaScript logic. Browser support is currently limited to Chrome 144 and above, with no confirmed status from Firefox or Safari.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in