Geolocation APIBaseline · Widely available
The navigator.geolocation API requests the user's latitude, longitude, heading, and speed.
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Jul 29, 2015. Widely available since Jan 29, 2018.
Browser support
DesktopChrome
1–4Not supported
5+Supportedsince May 25, 2010
Current: 155Edge
12+Supportedsince Jul 29, 2015
Current: 154Firefox
1–3Not supported
3.5+Supportedsince Jun 30, 2009
Current: 157Safari
1–4Not supported
5+Supportedsince Jun 7, 2010
Current: 27MobileChrome Android
18+Supportedsince Jun 27, 2012
Current: 155Firefox Android
4+Supportedsince Mar 29, 2011
Current: 157Safari iOS
1–2Not supported
≤3+Supportedsince Jun 17, 2009
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN: Geolocation.
Feature detection
JS · check before using
if ("Geolocation" in globalThis) {
// Geolocation is available
} else {
// load a polyfill or use a fallback
}Sub-features
Support for each part of the feature (29). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| Geolocation | 5 | 12 | 3.5 | 5 | 18 | 4 | ≤3 |
| Geolocation.clearWatch | 5 | 12 | 3.5 | 5 | 18 | 4 | ≤3 |
| Geolocation.getCurrentPosition | 5 | 12 | 3.5 | 5 | 18 | 4 | ≤3 |
| Geolocation.secure_context_required | 50 | 79 | 55 | 10 | 50 | 55 | 10 |
| Geolocation.watchPosition | 5 | 12 | 3.5 | 5 | 18 | 4 | ≤3 |
| GeolocationCoordinates | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| GeolocationCoordinates.accuracy | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| GeolocationCoordinates.altitude | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| GeolocationCoordinates.altitudeAccuracy | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| GeolocationCoordinates.heading | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| GeolocationCoordinates.latitude | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| GeolocationCoordinates.longitude | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| GeolocationCoordinates.secure_context_required | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| GeolocationCoordinates.speed | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| GeolocationCoordinates.toJSON | 126 | 126 | 129 | 18 | 126 | 129 | 18 |
| GeolocationPosition | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| GeolocationPosition.coords | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| GeolocationPosition.secure_context_required | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| GeolocationPosition.timestamp | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| GeolocationPosition.toJSON | 126 | 126 | 129 | 18 | 126 | 129 | 18 |
Show 9 more
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| GeolocationPositionError | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| GeolocationPositionError.code | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| GeolocationPositionError.message | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| GeolocationPositionError.secure_context_required | 79 | 79 | 72 | 13.1 | 79 | 79 | 13.4 |
| Navigator.geolocation | 5 | 12 | 3.5 | 5 | 18 | 4 | ≤3 |
| Navigator.geolocation.secure_context_required | 47 | 79 | 55 | 10 | 47 | 55 | 10 |
| Permissions.permission_geolocation | 43 | 79 | 46 | 16 | 43 | 46 | 16 |
| iframe.allow.geolocation | 64 | 79 | 74 | ✕ | 64 | 79 | ✕ |
| http.headers.Permissions-Policy.geolocation | 88 | 88 | ✕ | ✕ | 88 | ✕ | ✕ |