Favorites

HTML <geolocation> Tag

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
This is an experimental element. Its attributes and behaviour may change.
<geolocation>
HTML TagThis tag is supported in some modern browsers, but not all.
Updated 22nd November 2026

Description

The <geolocation> element is an experimental permission element that gives users a browser-controlled button for sharing their location with the page. When the user activates it, the browser asks for (or uses the existing) location permission and the page receives the position through events on the element, without having to call navigator.geolocation at an unexpected moment.

Because the button's text and appearance are controlled by the browser and the user has to click it, a permission request through <geolocation> is always a clear, intentional user action. This is meant to reduce the number of surprise permission prompts and to make it easier for users to change a previous "block" decision. Styling is restricted so the button cannot be disguised. It is currently only available in Chromium-based browsers and its design may still change.

Properties

Permitted Parents
Any element that accepts phrasing content
Content
Fallback content for browsers that do not support the element
Start/End Tags
Start tag: required, End tag: required

Example

<geolocation onlocation="console.log(event.target.position)">
Share your location (fallback text for browsers without support)
</geolocation>
Open in editor

Attributes

autolocate
Requests the position automatically when the page loads if permission has already been granted.
watch
Keeps receiving position updates while the permission remains granted.
accuracymode
Requests a precise or approximate location.

Global Attributes

The <geolocation> tag also supports the Global Attributes in HTML5

Event Attributes

The <geolocation> tag also supports the Event Attributes in HTML5

Browser Support

The following information will show you the current browser support for the HTML <geolocation> tag. Hover over a browser icon to see the version that first introduced support for this HTML tag.

This tag is supported in some modern browsers, but not all.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee