GeolocationPositionError

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

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

特性

GeolocationPositionError interface doesn't inherit any property .

GeolocationPositionError.code 只读 Secure context
Returns an unsigned short representing the error code. The following values are possible:
Associated constant 描述
1 PERMISSION_DENIED The acquisition of the geolocation information failed because the page didn't have the permission to do it.
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, defined by PositionOptions.timeout information was reached before the information was obtained.
GeolocationPositionError.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.

方法

GeolocationPositionError interface neither implements nor inherits any method.

规范

规范 状态 Comment
地理位置 API
The definition of 'GeolocationPositionError' in that specification.
Recommendation Initial specification.

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
GeolocationPositionError Chrome 79
79
不支持 5 — 78
Alternate Name
Alternate Name Uses the non-standard name: PositionError
Edge 79
79
不支持 12 — 79
Alternate Name
Alternate Name Uses the non-standard name: PositionError
Firefox 72
72
不支持 3.5 — 71
Alternate Name
Alternate Name Uses the non-standard name: PositionError
IE 9
Alternate Name
9
Alternate Name
Alternate Name Uses the non-standard name: PositionError
Opera 16
Alternate Name
16
Alternate Name
Alternate Name Uses the non-standard name: PositionError
Safari 5
Alternate Name
5
Alternate Name
Alternate Name Uses the non-standard name: PositionError
WebView Android 79
79
不支持 ? — 78
Alternate Name
Alternate Name Uses the non-standard name: PositionError
Chrome Android 79
79
不支持 18 — 78
Alternate Name
Alternate Name Uses the non-standard name: PositionError
Firefox Android 4
Alternate Name
4
Alternate Name
Alternate Name Uses the non-standard name: PositionError
Opera Android 16
Alternate Name
16
Alternate Name
Alternate Name Uses the non-standard name: PositionError
Safari iOS Yes
Alternate Name
Yes
Alternate Name
Alternate Name Uses the non-standard name: PositionError
Samsung Internet Android 12.0
12.0
不支持 1.0 — 12.0
Alternate Name
Alternate Name Uses the non-standard name: PositionError
code Chrome 5 Edge 12 Firefox 3.5 IE 9 Opera 16 Safari 5 WebView Android Yes Chrome Android 18 Firefox Android 4 Opera Android 16 Safari iOS Yes Samsung Internet Android 1.0
message Chrome 5 Edge 12 Firefox 3.5 IE 9 Opera 16 Safari 5 WebView Android Yes Chrome Android 18 Firefox Android 4 Opera Android 16 Safari iOS Yes Samsung Internet Android 1.0
Secure context required Chrome 47 Edge ≤18 Firefox 55 IE No Opera Yes Safari Yes WebView Android 47 Chrome Android 47 Firefox Android 55 Opera Android Yes Safari iOS Yes Samsung Internet Android 5.0

图例

完整支持
完整支持
不支持
不支持
使用非标名称。

另请参阅