Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
This feature is not Baseline because it does not work in some of the most widely-used browsers.
position は HTMLGeolocationElement インターフェイスの読み取り専用プロパティで、位置データの取得に成功した場合、ユーザーの現在地を表す GeolocationPosition オブジェクトを返します。
取得された位置情報は、最新である場合もあればそうでない場合もあります。<geolocation> 要素のボタンコントロールが押された際にのみ、ユーザーの位置情報が一度取得されます。ただし、watch 属性を true に設定した場合、ユーザー端末が移動するたびに新しい位置情報が取得されます。ユーザーの現在位置を読み取るには、location イベントが発生した際に position プロパティを参照する必要があります。
位置情報の取得に失敗した場合、関連付けられたエラー情報は HTMLGeolocationElement.error プロパティで取得できます。
GeolocationPosition オブジェクトです。位置データの取得に失敗した場合や、データがまだ取得されていない場合は null です。
position を含む実際の例については、組み込み地図の例の手順を追っての説明をご覧ください。
| The HTML Geolocation Element # dom-htmlgeolocationelement-position |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2026年2月11日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.