PositionError

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

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

Интерфейс PositionError представляет причину ошибки, возникающую при использовании устройства геолокации.

Свойства

Интерфейс PositionError не наследует никаких свойств.

PositionError.code Только для чтения Secure context

Возвращает unsigned short, представляющий код ошибки. Возможны следующие значения:

Значение Связанная константа Описание
1 PERMISSION_DENIED Не удалось получить информацию о геолокации, поскольку у страницы не было разрешения на это.
2 POSITION_UNAVAILABLE Не удалось получить геолокацию, поскольку по крайней мере один внутренний источник позиции вернул внутреннюю ошибку.
3 TIMEOUT Время, разрешённое для получения геолокации, определяется PositionOptions.timeout информация была достигнута до получения информации.
PositionError.message Только для чтения Secure context

Returns a human-readable DOMString 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.

Methods

The PositionError interface neither implements nor inherits any method.

Спецификации

Specification
Geolocation
# position_error_interface

Совместимость с браузерами

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
GeolocationPositionError
code
message
Secure context required

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Uses a non-standard name.
Has more compatibility info.

Смотрите также