ジオロケーション

W3C 勧告候補スナップショット

この文書の詳細
このバージョン:
https://www.w3.org/TR/2026/CR-geolocation-20260326/
最新版:
https://www.w3.org/TR/geolocation/
最新エディタドラフト:
https://w3c.github.io/geolocation/
履歴:
https://www.w3.org/standards/history/geolocation/
コミット履歴
テストスイート:
https://wpt.live/geolocation/
実装報告:
https://w3c.github.io/geolocation/reports/implementation.html
編集者:
Marcos Cáceres (Apple Inc.)
Reilly Grant (Google)
以前の編集者:
Andrei Popescu (Google Inc.)
フィードバック:
GitHub w3c/geolocation (プルリクエスト, 新しいイシュー, オープンイシュー)
正誤表:
正誤表あり
ブラウザー対応:
caniuse.com

概要

ジオロケーションはホスティングデバイスに関連付けられた地理的位置情報へのアクセスを 提供します。

この文書のステータス

このセクションは、本書が公開された時点での 文書のステータスについて説明しています。現在の W3C の公開文書や、この技術レポートの最新版は W3C 標準とドラフトのインデックス に掲載されています。

Geolocationは W3C 勧告として2022年9月1日に公開されました。2026年3月には、作業グループが実質的な変更をより効率的に繰り返し、新たな機能追加を継続できるよう、本仕様は勧告候補に戻りました。

公開時点では、Devices and Sensors Working Groupは依然として 2020年9月15日版のW3C特許ポリシーの下で活動しています。

本文書はDevices and Sensors Working Groupおよび Web Applications Working Groupによって、 勧告トラックを用いて 勧告候補スナップショットとして公開されました。

勧告候補としての公開は、W3Cおよびそのメンバーによる承認を意味するものではありません。 勧告候補スナップショットは幅広いレビューを受けており、 実装経験の収集を目的とし、 ワーキンググループのメンバーによる ロイヤリティフリーライセンス の約束がなされています。

この勧告候補が勧告へ進むのは、2026年4月31日より早くはならない見込みです。

本文書は W3C 特許ポリシー の下で活動しているグループによって作成されました。 W3C(Devices and Sensors Working Group)に関する公開特許開示リスト および (Web Applications Working Group)に関する公開特許開示リスト を管理しています。これらのページには特許開示の手順も記載されています。 個人が必須請求項を含むと信じる特許について実際に知っている場合は、 Essential Claim(s) の情報を W3C特許ポリシーの第6節 に従って開示する必要があります。

本文書は 2025年8月18日 W3Cプロセス文書 に従って管理されています。

1. 導入

この節は非規範的です。

Geolocation は、実装をホストするデバイスにのみ関連付けられた位置情報への高レベルなインターフェースを定義します。 位置情報の一般的なソースには、全地球測位システム(GPS)や IP アドレス、RFID、WiFi および Bluetooth の MAC アドレス、GSM/CDMA のセル ID などのネットワーク信号から推定される位置、ならびにユーザー入力が含まれます。API 自体は基盤となる位置情報ソースに依存せず、API がデバイスの実際の位置を返すことを保証するものではありません。

エンドユーザーが 許可を与える と、 Geolocation は次のことを行います:

1.1 範囲

この節は非規範的です。

本仕様は、ホスティングデバイスに関連付けられた地理的な位置情報を取得するためのスクリプト API の提供に限定されます。地理的な位置情報は 世界測地系座標 [WGS84] の用語で提供されます。本仕様は何らかのマークアップ言語を提供するものではなく、地理的位置を識別する URL を構築するための新しい URL スキームを定義するものでもありません。

2.

この節は非規範的です。

API は「ワンショット」位置要求と繰り返し位置更新の両方を可能にするよう設計されています。以下の例は一般的なユースケースを示しています。

2.1 現在位置を取得

この節は非規範的です。

ユーザーの現在位置を要求します。ユーザーが許可すれば、位置オブジェクトが返されます。

2.2 位置を監視

この節は非規範的です。

ユーザーの現在位置を監視する機能を要求します。ユーザーが許可すれば、位置の継続的な更新が返されます。

2.3 位置の監視を停止

この節は非規範的です。

clearWatch() メソッドを呼び出して位置変化の監視を停止します。

2.4 エラーの処理

この節は非規範的です。

エラーが発生した場合、watchPosition() または getCurrentPosition() メソッドの第 2 引数に GeolocationPositionError が渡され、何が問題だったかを把握するのに役立ちます。

2.5 maximumAge をキャッシュ制御として使用

この節は非規範的です。

デフォルトでは、API は以前に取得した位置が存在する限り常にキャッシュされた位置を返そうとします。この例では、位置の年齢が 10 分を超えないことを許容します。ユーザーエージェントが十分に新しいキャッシュされた位置オブジェクトを持っていない場合、自動的に新しい位置を取得します。

2.6 timeout の使用

この節は非規範的です。

時間に敏感な方法で位置情報が必要な場合は、PositionOptionstimeout メンバーを使用して、 位置を取得するために待てる時間の上限を制限できます。

2.7 サードパーティコンテキストでの API の有効化

この節は非規範的です。

デフォルト許可リスト'self' は同一オリジンのネストされたフレームでの API 使用を許可しますが、サードパーティのコンテンツによる API の使用を防ぎます。

サードパーティの使用は、allow="geolocation" 属性を iframe 要素に追加することで選択的に有効化できます:

あるいは、HTTP レスポンスヘッダーを指定してファーストパーティコンテキストで API を無効にすることもできます:

Permissions Policy を参照すると、 Permissions-Policy HTTP ヘッダーの詳細が確認できます。

3. プライバシーに関する考慮事項

この節は非規範的です。

本仕様で定義された API はホスティングデバイスの地理的位置を取得するために使用されます。ほとんどの場合、この情報はデバイスのユーザーの位置も明らかにするため、ユーザーのプライバシーを損なう可能性があります。

3.2 位置情報受信者に関するプライバシーの考慮事項

この節は非規範的です。

: この機微なデータに関する開発者の責任

この節は「受信者」に適用され、一般には Geolocation を利用する開発者を意味します。ユーザーエージェントや本仕様がこれらの要件を強制することは不可能ですが、開発者はこの節を注意深く読み、以下の提案にできるだけ従う必要があります。開発者は、ユーザーの位置データの使用およびアクセスを規制するプライバシー法が自らの管轄に存在する可能性があることを認識しておく必要があります。

受信者は、必要な場合にのみ位置情報を要求し、位置情報は提供されたタスクのためだけに使用すべきです。タスクが完了したら位置情報は破棄すべきであり、ユーザーに明示的に保持を許可されない限り保存してはなりません。受信者はこの情報を不正アクセスから守るための措置を講じる必要があります。位置情報が保存される場合、ユーザーがその情報を更新および削除できるようにする必要があります。

位置情報の受信者は、ユーザーの明示的な許可なしに位置情報を再送信することを控えるべきです。再送信する場合は注意が必要であり、暗号化の使用が推奨されます。

受信者は、位置データを収集していること、その収集目的、データの保持期間、データの保護方法、共有される場合の共有方法、ユーザーがデータにアクセス・更新・削除する方法、ならびにデータに関してユーザーが持つその他の選択肢を明確かつ分かりやすく開示すべきです。この開示には上記ガイドラインの例外の説明も含める必要があります。

3.3 実装上の考慮事項

この節は非規範的です。

実装者は、ユーザーのプライバシーに悪影響を及ぼす可能性のある次の点を考慮することが勧められます: 特定の場合において、ユーザーは意図せずユーザーエージェントに対してウェブサイトに自分の位置を開示する許可を与えてしまうことがあります。他の場合では、ある URL にホストされたコンテンツが変更され、以前に付与された位置許可がユーザーの観点ではもはや適用されなくなることがあります。またはユーザーが単に心変わりすることもあります。

これらの状況を予測したり防止したりすることは本質的に困難です。緩和策および高度な防御的措置は実装者の責任であり、本仕様で規定されるものではありません。ただし、これらの措置を設計する際には、実装者は位置共有に関するユーザーの認識を高め、許可の取り消しを可能にするユーザーインターフェースへのアクセスを提供することを勧められます。

3.4 API 使用権限の確認

Geolocationデフォルトの強力な機能 として識別され、 名前 として "geolocation" が使用されます。

API を使用するための 権限確認 の際に、ユーザーエージェントは MAY 時間ベースの 許可 ライフタイム(例: "24 hours", "1 week")を提案したり、 選択して 許可を記憶する 付与 を無期限にすることを選ぶことができます。しかし、 それにもかかわらず、ユーザーエージェントは RECOMMENDED として優先的に 許可ライフタイム を単一のセッションに制限することを 優先するべきです: これは例えば、realm が破棄されるまで、エンドユーザーが ナビゲート して オリジン を離れるまで、または 対応するブラウザタブが閉じられるまで、のように扱うことができます。

4. セキュリティに関する考慮事項

公開時点では、Geolocation に関連するセキュリティ上の考慮事項はありません。ただし、読者は 3. プライバシーに関する考慮事項 を読むことを推奨します。

6. Geolocation インターフェースとコールバック

WebIDL[Exposed=Window]
interface Geolocation {
  undefined getCurrentPosition (
    PositionCallback successCallback,
    optional PositionErrorCallback? errorCallback = null,
    optional PositionOptions options = {}
  );

  long watchPosition (
    PositionCallback successCallback,
    optional PositionErrorCallback? errorCallback = null,
    optional PositionOptions options = {}
  );

  undefined clearWatch (long watchId);
};

callback PositionCallback = undefined (
  GeolocationPosition position
);

callback PositionErrorCallback = undefined (
  GeolocationPositionError positionError
);

6.1 内部スロット

Geolocation のインスタンスは以下の表に示す内部スロットで作成されます:

Internal slot Description
[[cachedPosition]] A GeolocationPosition, initialized to null. It's a reference to the last acquired position and serves as a cache. A user agent MAY evict [[cachedPosition]] by resetting it to null at any time for any reason.
[[watchIDs]] Initialized as an empty list of unsigned long items.

6.2 getCurrentPosition() メソッド

The getCurrentPosition(successCallback, errorCallback, options) メソッドの手順は次のとおりです:

  1. If this's relevant global object's associated Document is not fully active:
    1. Call back with error errorCallback and POSITION_UNAVAILABLE.
    2. Terminate this algorithm.
  2. Request a position passing this, successCallback, errorCallback, and options.

6.3 watchPosition() メソッド

The watchPosition(successCallback, errorCallback, options) メソッドの手順は次のとおりです:

  1. If this's relevant global object's associated Document is not fully active:
    1. Call back with error passing errorCallback and POSITION_UNAVAILABLE.
    2. Return 0.
  2. Let watchId be an implementation-defined unsigned long that is greater than zero.
  3. Append watchId to this's [[watchIDs]].
  4. Request a position passing this, successCallback, errorCallback, options, and watchId.
  5. Return watchId.

6.4 clearWatch() メソッド

When clearWatch() is invoked, the user agent MUST:

  1. Remove watchId from this's [[watchIDs]].

6.5 位置の要求

位置を 要求する には、Geolocation geolocationPositionCallbacksuccessCallbackPositionErrorCallback?errorCallbackPositionOptionsoptions、および省略可能な watchId を渡します:

  1. Let watchIDs be geolocation's [[watchIDs]].
  2. Let document be the geolocation's 関連するグローバルオブジェクト関連付けられた Document.
  3. If document is not 使用が許可されている the "geolocation" feature:
    1. If watchId was passed, remove watchId from watchIDs.
    2. エラーでコールバックを呼び出す として errorCallbackPERMISSION_DENIED を渡します。
    3. このアルゴリズムを終了します。
  4. If geolocation's 環境設定オブジェクト is a 非セキュアコンテキスト:
    1. If watchId was passed, remove watchId from watchIDs.
    2. エラーでコールバックを呼び出す として errorCallbackPERMISSION_DENIED を渡します。
    3. このアルゴリズムを終了します。
  5. If document's 可視性状態 is "hidden", wait for the following ページ可視性変更手順 to run:
    1. Assert: document's 可視性状態 is "visible".
    2. 以下の次の手順に進みます。
  6. Let descriptor be a new PermissionDescriptor whose name is "geolocation".
  7. 並列で:
    1. Set permission to 許可の要求 for descriptor.
    2. If permission is "denied", then:
      1. If watchId was passed, remove watchId from watchIDs.
      2. エラーでコールバックを呼び出す として errorCallbackPERMISSION_DENIED を渡します。
      3. このアルゴリズムを終了します。
    3. Wait to 位置を取得する ために successCallback, errorCallback, options, および watchId を渡します。
    4. If watchId was not passed, terminate this algorithm.
    5. While watchIDs contains watchId:
      1. 位置の大きな変化を待機する。何が「位置の大きな変化」に相当するかは実装に委ねられます。ユーザーエージェントは報告頻度にレート制限を課すことが MAY あります。ユーザーエージェントは MUSTエミュレート位置データの設定 を重大な変化として考慮する必要があります。
      2. If document is not 完全にアクティブ または 可視性状態 が "visible" でない場合、前のステップに戻り再び 位置の大きな変化を待機する
        : 位置の更新は完全にアクティブで可視なドキュメントに限られる
      3. Wait to 位置を取得する ために successCallbackerrorCallbackoptions、および watchId を渡します。

6.6 位置の取得

位置を 取得する には、PositionCallbacksuccessCallbackPositionErrorCallback?errorCallbackPositionOptionsoptions、および省略可能な watchId を渡します。

  1. If watchId was passed and this's [[watchIDs]] does not contain watchId, terminate this algorithm.
  2. Let acquisitionTime be a new EpochTimeStamp that represents now.
  3. Let timeoutTime be the sum of acquisitionTime and options.timeout.
  4. Let cachedPosition be this's [[cachedPosition]].
  5. Create an implementation-specific timeout task that elapses at timeoutTime, during which it tries to acquire the device's position by running the following steps:
    1. Let permission be 現在の許可状態の取得 of "geolocation".
    2. If permission is "denied":
      1. Stop timeout.
      2. Do the ユーザーまたはシステムによる許可拒否 の失敗ケース手順。
    3. If permission is "granted":
      1. エミュレート位置を使用すべきか確認するため、以下の手順を実行します:
        1. Let emulatedPositionData be エミュレート位置データを取得 passing this.
        2. If emulatedPositionData is not null:
          1. If emulatedPositionData is a GeolocationPositionError:
            1. エラーでコールバックを呼び出す として errorCallbackemulatedPositionDatacode を渡します。
            2. このアルゴリズムを終了します。
          2. Let position be 新しい GeolocationPosition を作成し、emulatedPositionDataacquisitionTime、および options.enableHighAccuracy を渡します。
          3. タスクをキューに入れる on the geolocation タスクソース で、 successCallback を « position » と "report" で呼び出す ステップを登録します。
          4. このアルゴリズムを終了します。
      2. Let position be null.
      3. If cachedPosition is not null, and options.maximumAge is greater than 0:
        1. Let cacheTime be acquisitionTime minus the value of the options.maximumAge member.
        2. If cachedPosition's timestamp's value is greater than cacheTime, and cachedPosition.[[isHighAccuracy]] equals options.enableHighAccuracy:
          1. タスクをキューに入れる on the geolocation タスクソース で、 successCallback を « cachedPosition » と "report" で呼び出す ステップを登録します。
          2. このアルゴリズムを終了します。
      4. Otherwise, if position is not cachedPosition, try to acquire position data from the underlying system, optionally taking into consideration the value of options.enableHighAccuracy during acquisition.
      5. If the timeout elapses during acquisition, or acquiring the device's position results in failure:
        1. Stop the timeout.
        2. Go to 失敗への対処.
        3. このアルゴリズムを終了します。
      6. If acquiring the position data from the system succeeds:
        1. Let positionData be a map with the following name/value pairs based on the acquired position data:
          "accuracy"
          A non-negative double that represents the accuracy value indicating the 95% confidence level in meters. Accuracy measures how close the measured coordinates are to the true position.
          "altitude"
          A double? that represents the altitude in meters above the [WGS84] ellipsoid, or null if not available. Altitude measures the height above sea level.
          "altitudeAccuracy"
          A non-negative double? that represents the altitude accuracy, or null if not available, indicating the 95% confidence level in meters. Altitude accuracy measures how close the measured altitude is to the true altitude.
          "heading"
          A double? that represents the heading in degrees, or null if not available or the device is stationary. Heading measures the direction in which the device is moving relative to true north.
          "latitude"
          A double that represents the latitude coordinates on the Earth's surface in degrees, using the [WGS84] coordinate system. Latitude measures how far north or south a point is from the Equator.
          "longitude"
          A double that represents the longitude coordinates on the Earth's surface in degrees, using the [WGS84] coordinate system. Longitude measures how far east or west a point is from the Prime Meridian.
          "speed"
          A non-negative double? that represents the speed in meters per second, or null if not available. Speed measures how fast the device is moving.
        2. Set position to 新しい GeolocationPosition を作成し、positionDataacquisitionTime、および options.enableHighAccuracy を渡します。
        3. Set this's [[cachedPosition]] to position.
      7. Stop the timeout.
      8. タスクをキューに入れる on the geolocation タスクソース successCallback を « position » と "report" で呼び出す ステップを登録します。
    失敗への対処:

6.7 エラーでコールバックを呼び出す

エラーでコールバックを呼び出す 指示があったとき、与えられた PositionErrorCallback?callbackunsigned shortcode が与えられた場合:

  1. If callback is null, return.
  2. Let error be a newly created GeolocationPositionError instance whose code attribute is initialized to code.
  3. タスクをキューに入れる on the geolocation タスクソース で、 callback を « error » と "report" で呼び出す ステップを登録します。

7. PositionOptions 辞書

WebIDLdictionary PositionOptions {
  boolean enableHighAccuracy = false;
  [Clamp] unsigned long timeout = 0xFFFFFFFF;
  [Clamp] unsigned long maximumAge = 0;
};

7.1 enableHighAccuracy メンバー

The enableHighAccuracy メンバーは、アプリケーションが できる限り正確な位置情報を受け取りたいことを示すヒントを提供します。 このメンバーの目的は、アプリケーションが高精度のジオロケーション修正を必須としないことを実装に伝え、したがって実装側が 大きな電力を消費するジオロケーションプロバイダ(例えば GPS)の使用を回避することを MAY できるようにすることです。

Note: enableHighAccuracy に関する注意

7.2 timeout メンバー

The timeout メンバーは、位置の取得が失効するまでの最大時間を ミリ秒単位で示します。

Note: タイムアウトはいつ計算されるか?

ドキュメントが可視状態になるのを待つ時間や、API 使用権限の取得に要する時間は、 timeout によってカバーされる期間には含まれません。 timeout メンバーは、位置の取得 が開始されたときにのみ適用されます。

Note: 即時キャンセル

7.3 maximumAge メンバー

The maximumAge メンバーは、ウェブアプリケーションが許容する キャッシュされた位置の最大年齢をミリ秒単位で示します。

8. GeolocationPosition インターフェース

WebIDL[Exposed=Window, SecureContext]
interface GeolocationPosition {
  readonly attribute GeolocationCoordinates coords;
  readonly attribute EpochTimeStamp timestamp;
  [Default] object toJSON();
};

8.1 coords 属性

The coords 属性は地理座標を含みます。

8.2 timestamp 属性

The timestamp 属性は、デバイスの地理位置が取得された時刻を表します。

8.3 toJSON() メソッド

The toJSON() メソッドは、GeolocationPosition オブジェクトの JSON 表現を返します。

8.4 内部スロット

GeolocationPosition のインスタンスは、以下の表に示された内部スロットを持って作成されます:

Internal slot 説明
[[isHighAccuracy]] A boolean that records the value of the enableHighAccuracy メンバーの値を、この GeolocationPosition作成 されたときに記録します。

8.5 タスクソース

本仕様で定義される次の task source があります。

geolocation task source
位置要求を実行する際に、非ブロッキングな PositionCallback および PositionErrorCallback をキューに入れるために本仕様で使用されます。

9. GeolocationCoordinates インターフェース

WebIDL[Exposed=Window, SecureContext]
interface GeolocationCoordinates {
  readonly attribute double accuracy;
  readonly attribute double latitude;
  readonly attribute double longitude;
  readonly attribute double? altitude;
  readonly attribute double? altitudeAccuracy;
  readonly attribute double? heading;
  readonly attribute double? speed;
  [Default] object toJSON();
};

9.1 latitude, longitude, and accuracy 属性

The latitude および longitude 属性は、 位置を度単位の実数で表し、[WGS84] 座標系を用います。

The accuracy 属性は、位置の精度半径をメートル単位で表します。

9.2 altitudealtitudeAccuracy 属性

The altitude 属性は、位置の高さを [WGS84] 楕円体上のメートルで示します。

The altitudeAccuracy 属性は、高度の精度をメートル単位で表します(例えば 10 メートル)。

9.3 heading 属性

The heading 属性は、ホスティングデバイスの進行方向を角度(度)で表し、0° ≤ heading < 360° の範囲で真北に対して時計回りに測ります。

9.4 speed 属性

The speed 属性は、ホスティングデバイスの現在の速度の水平方向成分の大きさをメートル毎秒で示します。

9.5 toJSON() メソッド

The toJSON() メソッドは、GeolocationCoordinates オブジェクトの JSON 表現を返します。

9.6 GeolocationPosition の構築

新しい GeolocationPosition は、mappositionDataEpochTimeStamptimestamp、および boolean の isHighAccuracy を用いて次の手順で構築されます:

  1. Let coords be a newly created GeolocationCoordinates インスタンスにします。
  2. For each keyvalue in positionData:
    1. Set coords's attribute named key to value.
  3. Return a newly created GeolocationPosition インスタンスで、その coords 属性は coords に初期化され、 timestamp 属性は timestamp に初期化され、内部スロット [[isHighAccuracy]]isHighAccuracy に設定されます。

10. GeolocationPositionError インターフェース

WebIDL[Exposed=Window]
interface GeolocationPositionError {
  const unsigned short PERMISSION_DENIED = 1;
  const unsigned short POSITION_UNAVAILABLE = 2;
  const unsigned short TIMEOUT = 3;
  readonly attribute unsigned short code;
  readonly attribute DOMString message;
};

10.1 定数

PERMISSION_DENIED(数値 1)
位置要求 が、ユーザーによる API 利用の許可拒否、 または 非セキュアコンテキスト から行われたために失敗した場合。
POSITION_UNAVAILABLE(数値 2)
位置の取得 に失敗した場合。
TIMEOUT(数値 3)
timeout メンバーで指定された時間が経過しても、ユーザーエージェントが正常に 位置を取得 できなかった場合。

10.2 code 属性

code 属性は、エラーでコールバックを呼び出すときに初期化された値 を返します(可能な値は 10.1 定数 を参照)。

10.3 message 属性

message 属性は、code 属性の開発者向けの テキストによる説明です。

: .message をユーザーに表示しないでください!

11. 許可ポリシー

本仕様は、トークン文字列 "geolocation" によって識別される ポリシー制御機能 を定義します。その デフォルト許可リスト'self' です。

12. エミュレーション

ユーザーエージェントの自動化やアプリケーションのテストの目的のために、本書はジオロケーションのエミュレーションを定義します。

トップレベルの traversable には、関連付けられた エミュレートされた位置データ があり、これは初期値が null の GeolocationCoordinatesGeolocationPositionError、または null を表すデータです。

エミュレート位置データを設定する には、与えられた navigable navigableemulatedPositionData を使用します:

  1. Assert: emulatedPositionData が null、GeolocationCoordinates、または GeolocationPositionError のいずれかであることを保証します。
  2. Let traversable be navigabletop-level traversable
  3. If traversable is not null:
    1. traversable に関連付けられた エミュレート位置データemulatedPositionData に設定します。
    2. ユーザーエージェントは、この変更を 位置の大きな変化を待機する ステップにおける「重大な変化」とみなすことを MUST です。

エミュレート位置データを取得する には、与えられた Geolocation geolocation を使用します:

  1. Let navigable be geolocation関連するグローバルオブジェクト関連付けられた Documentnode navigable
  2. If navigable is null, return null.
  3. Let traversable be navigabletop-level traversable
  4. If traversable is null, return null.
  5. Return traversable に関連付けられた エミュレート位置データ

13. 適合性

非規範と明示された節のほかに、本仕様のすべての作成ガイドライン、図、例、および注は非規範的です。それ以外のすべては本仕様において規範的です。

本書で使用されるキーワード MAYMUST、および RECOMMENDED は、すべて大文字で表示されている場合に限り、BCP 14 [RFC2119] [RFC8174] に記載されているとおりに解釈されます。

A. IDL インデックス

WebIDLpartial interface Navigator {
  [SameObject] readonly attribute Geolocation geolocation;
};

[Exposed=Window]
interface Geolocation {
  undefined getCurrentPosition (
    PositionCallback successCallback,
    optional PositionErrorCallback? errorCallback = null,
    optional PositionOptions options = {}
  );

  long watchPosition (
    PositionCallback successCallback,
    optional PositionErrorCallback? errorCallback = null,
    optional PositionOptions options = {}
  );

  undefined clearWatch (long watchId);
};

callback PositionCallback = undefined (
  GeolocationPosition position
);

callback PositionErrorCallback = undefined (
  GeolocationPositionError positionError
);

dictionary PositionOptions {
  boolean enableHighAccuracy = false;
  [Clamp] unsigned long timeout = 0xFFFFFFFF;
  [Clamp] unsigned long maximumAge = 0;
};

[Exposed=Window, SecureContext]
interface GeolocationPosition {
  readonly attribute GeolocationCoordinates coords;
  readonly attribute EpochTimeStamp timestamp;
  [Default] object toJSON();
};

[Exposed=Window, SecureContext]
interface GeolocationCoordinates {
  readonly attribute double accuracy;
  readonly attribute double latitude;
  readonly attribute double longitude;
  readonly attribute double? altitude;
  readonly attribute double? altitudeAccuracy;
  readonly attribute double? heading;
  readonly attribute double? speed;
  [Default] object toJSON();
};

[Exposed=Window]
interface GeolocationPositionError {
  const unsigned short PERMISSION_DENIED = 1;
  const unsigned short POSITION_UNAVAILABLE = 2;
  const unsigned short TIMEOUT = 3;
  readonly attribute unsigned short code;
  readonly attribute DOMString message;
};

B. 索引

B.1 本仕様で定義された用語

B.2 参照で定義された用語

C. 謝辞

この節は非規範的です。

本仕様は、Aza Raskin による研究、Google Gears Geolocation API、および LocationAware.org を含む 業界における以前の作業に基づいています。

また、Alec Berntson、Alissa Cooper、Steve Block、Greg Bolsinga、Lars Erik Bolstad、Aaron Boodman、Dave Burke、Chris Butler、 Max Froumentin、Shyam Habarakada、Marcin Hanclik、Ian Hickson、Brad Lassey、Angel Machin、Cameron McCormack、Daniel Park、Stuart Parmenter、 Olli Pettay、Chris Prince、Arun Ranganathan、Carl Reed、Thomas Roessler、Dirk Segers、Allan Thomson、Martin Thomson、Doug Turner、Erik Wilde、Matt Womer、および Mohamed Zergaoui に感謝します。

D. 変更履歴

この節は非規範的です。

Since publication as a W3C Recommendation in 2022, Geolocation has received the following normative changes:

Since First Public Working Draft in 2021, until it was published as a W3C Recommendation in 2022, Geolocation received the following normative changes:

Since publication of the Second Edition in 2016, this specification received the following substantive changes:

See the commit history for a complete list of changes.

E. 参考文献

E.1 規範的参照

[hr-time]
High Resolution Time。Yoav Weiss。W3C。2026年3月2日。W3C Working Draft。URL: https://www.w3.org/TR/hr-time-3/
[html]
HTML Standard。Anne van Kesteren; Domenic Denicola; Dominic Farolino; Ian Hickson; Philip Jägenstedt; Simon Pieters。WHATWG。Living Standard。URL: https://html.spec.whatwg.org/multipage/
[infra]
Infra Standard。Anne van Kesteren; Domenic Denicola。WHATWG。Living Standard。URL: https://infra.spec.whatwg.org/
[Permissions]
Permissions。Marcos Caceres; Mike Taylor。W3C。2025年10月6日。W3C Working Draft。URL: https://www.w3.org/TR/permissions/
[permissions-policy]
Permissions Policy。Ian Clelland。W3C。2025年10月6日。W3C Working Draft。URL: https://www.w3.org/TR/permissions-policy-1/
[RFC2119]
Key words for use in RFCs to Indicate Requirement Levels。S. Bradner。IETF。1997年3月。Best Current Practice。URL: https://www.rfc-editor.org/rfc/rfc2119
[RFC8174]
Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words。B. Leiba。IETF。2017年5月。Best Current Practice。URL: https://www.rfc-editor.org/rfc/rfc8174
[webidl]
Web IDL Standard。Edgar Chen; Timothy Gu。 WHATWG。Living Standard。URL: https://webidl.spec.whatwg.org/
[WGS84]
World Geodetic System 1984 (WGS 84)。Office of Geomatics, National Geospatial Intelligence Agency。2008年。URL: https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84