Chrome 144 introduces the `<geolocation>` HTML element, a declarative alternative to the JavaScript Geolocation API. This element requires user interaction (clicking a button) to request location data, reducing accidental blocks and browser interventions. It evolved from a generic `<permission>` element after origin trial feedback showed improved user trust and success rates. The element simplifies implementation by handling permission states automatically, supports attributes like `autolocate` and `watch`, and includes styling constraints to prevent deceptive patterns. A polyfill and progressive enhancement strategies ensure backward compatibility with browsers that don't support the new element.

8m read timeFrom developer.chrome.com
Post cover image
Table of contents
From generic <permission> to specific <geolocation>Validation of the conceptRedefinition of the designWhy use the <geolocation> element?ImplementationProgressive enhancement strategyWrap upRelated linksAcknowledgements
24 Comments

Sort: