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.
promptaction は HTMLGeolocationElement インターフェイスのイベントで、ユーザーが <geolocation> 要素をアクティブにし、表示されるダイアログから geolocation 権限を許可または拒否するオプションを選択するたびに発生します。
このイベント名を addEventListener() 等のメソッドで使用するか、イベントハンドラープロパティを設定するかしてください。
Event です。
埋め込み地図の例(ソースコード)では、promptaction イベントハンドラーを使用して、<geolocation> 権限プロンプトでユーザーが選択を行った際の応答を行います。
notifyUserGrantPermission() 関数では、HTMLGeolocationElement.permissionStatus プロパティを使用して、権限の状態が denied または prompt かどうかを調べます。該当する場合は、ユーザーに再度ボタンを押して位置情報の許可を求めるよう促します。既に許可が与えられている場合は、この確認は必要ありません。
この例の完全な手順を追った解説については、HTMLGeolocationElement のメインページを参照してください。
| The HTML Geolocation Element # dom-powerfulfeatureobserver-onpromptaction |
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.