PositionError.code

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.

PositionError.code 是一個唯讀無符號整數(unsigned short)表示錯誤碼。以下列出可能的值:

相對應的常數 描述
1 PERMISSION_DENIED 取得地理資訊失敗,因為此頁面沒有獲取地理位置信息的權限。
2 POSITION_UNAVAILABLE 取得地理資訊失敗,因為至少有一個地理位置信息內的資訊回傳了錯誤。
3 TIMEOUT 取得地理資訊超過時限,利用 PositionOptions.timeout i 來定義取得地理資訊的時限。

語法

typeErr = poserr.code

規格

Specification
Geolocation
# code-attribute

瀏覽器的相容性

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
code

Legend

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

Full support
Full support

請參考