HTML <geolocation> Tag
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
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.
Desktop





Tablets & Mobile





