← Back to release summary

The <geolocation> element

Category
DOM
Type
New or changed feature
Status
Origin trial (Chrome 144)
Intent stage
None

Summary

Introduces the <geolocation> element, a declarative, user-activated control for accessing the user's location. It streamlines the user and developer journey by not only handling the permission flow but also directly providing location data to the site, often eliminating the need for a separate JavaScript API call. This addresses the long-standing problem of permission prompts being triggered directly from JavaScript without a strong signal of user intent. By embedding a browser-controlled element in the page, the user's click provides a clear, intentional signal. This enables a much better prompt UX and, crucially, provides a simple recovery path for users who have previously denied the permission. Note: This feature was previously developed and tested in an Origin Trial as the more generic <permission> element. Based on feedback from developers and other browser vendors, it has evolved into the capability-specific <geolocation> element to provide a more tailored and powerful developer experience. Explainer: https://github.com/WICG/PEPC/blob/main/geolocation_explainer.md Instructions: https://github.com/WICG/PEPC/blob/main/HOWTO.md

Motivation

The current web permission model for geolocation relies on JavaScript-triggered prompts, giving the user agent no strong signal of user intent. This results in out-of-context prompts, user frustration, and difficult-to-recover-from denial states. We propose the <geolocation> element, a semantic HTML control with browser-controlled content and strict styling constraints. These constraints are fundamental to the security model, ensuring a very high level of confidence in the user's intent when making a permission decision at both the site and OS level. Crucially, the <geolocation> element evolves beyond simply managing permissions; it streamlines the entire journey by also directly providing location data to the site. This often eliminates the need for separate JavaScript API calls, simplifying implementation and creating a more seamless user flow. By providing a clear, consistent, in-page control, this element solves significant user problems related to context blindness and "permission regret," offering a simple recovery path from a previously denied state. The combination of a user-initiated element and a subsequent browser-controlled confirmation UI enhances intent capture, improves accessibility, and prevents manipulative patterns, providing a significantly better experience for both users and developers.

Standards & signals

Samples: https://permission.site/pepc

Explainers: https://github.com/WICG/PEPC/blob/main/explainer.md https://github.com/WICG/PEPC/blob/main/geolocation_explainer.md

View on chromestatus.com