This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2020.
* Some parts of this feature may have varying levels of support.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The GeolocationPosition interface represents the position of the concerned device at a given time. The position, represented by a GeolocationCoordinates object, comprehends the 2D position of the device, on a spheroid representing the Earth, but also its altitude and its speed.
The GeolocationPosition interface doesn't inherit any properties.
GeolocationPosition.coords Read only
Returns a GeolocationCoordinates object defining the current location.
GeolocationPosition.timestamp Read only
Returns a timestamp, given as Unix time in milliseconds, representing the time at which the location was retrieved.
The GeolocationPosition interface doesn't inherit any methods.
GeolocationPosition.toJSON()Returns a JSON representation of the GeolocationPosition object and enables serialization with JSON.stringify().
| Specification |
|---|
| Geolocation> # position_interface> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
GeolocationPosition |
795–78 | 7912–79 | 723.5–71 | 6615–65 | 13.15–13.1 | 7918–78 | 794–79 | 5714–56 | 13.4≤3–13.4 | 12.01.0–12.0 | 794.4–78 | 13.4≤3–13.4 |
coords |
5 | 12 | 3.5 | 16 | 5 | 18 | 4 | 16 | ≤3 | 1.0 | 4.4 | ≤3 |
secure_context_required |
47 | ≤18 | 55 | 34 | 10 | 47 | 55 | 34 | 10 | 5.0 | 47 | 10 |
timestamp |
5 | 12 | 3.5 | 16 | 5 | 18 | 4 | 16 | ≤3 | 1.0 | 4.4 | ≤3 |
toJSON |
126 | 126 | 129 | 112 | 18 | 126 | 129 | 83 | 18 | 28.0 | 126 | 18 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/GeolocationPosition