/Web APIs


Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The GeolocationPositionError interface represents the reason of an error occurring when using the geolocating device.

Instance properties

The GeolocationPositionError interface doesn't inherit any property.

GeolocationPositionError.code Read only Secure context

Returns an unsigned short representing the error code. The following values are possible:

Value Associated constant Description
1 PERMISSION_DENIED The acquisition of the geolocation information failed because the page didn't have the necessary permissions, for example because it is blocked by a Permissions Policy
2 POSITION_UNAVAILABLE The acquisition of the geolocation failed because at least one internal source of position returned an internal error.
3 TIMEOUT The time allowed to acquire the geolocation was reached before the information was obtained.
GeolocationPositionError.message Read only Secure context

Returns a human-readable string describing the details of the error. Specifications note that this is primarily intended for debugging use and not to be shown directly in a user interface.

Instance methods

The GeolocationPositionError interface neither implements nor inherits any method.


Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
GeolocationPositionError 795–78 7912–79 723.5–71 9 16 13.15 79≤37–78 7918–78 794–79 16 13.44.2 12.01.0–12.0
code 5 12 3.5 9 16 5 ≤37 18 4 16 4.2 1.0
message 5 12 3.5 9 16 5 ≤37 18 4 16 4.2 1.0
secure_context_required 47 ≤18 55 No 34 10 47 47 55 34 10 5.0

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.