From 972595697b25aa8cbf631f7653e178891efa40a6 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Thu, 3 Feb 2022 01:04:23 +0900 Subject: Geolocation インターフェイスの記事を移行 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/ja/web/api/geolocation/clearwatch/index.html | 95 --------------------- files/ja/web/api/geolocation/clearwatch/index.md | 95 +++++++++++++++++++++ .../api/geolocation/getcurrentposition/index.html | 93 --------------------- .../api/geolocation/getcurrentposition/index.md | 93 +++++++++++++++++++++ files/ja/web/api/geolocation/index.html | 73 ---------------- files/ja/web/api/geolocation/index.md | 73 ++++++++++++++++ .../web/api/geolocation/watchposition/index.html | 97 ---------------------- .../ja/web/api/geolocation/watchposition/index.md | 97 ++++++++++++++++++++++ 8 files changed, 358 insertions(+), 358 deletions(-) delete mode 100644 files/ja/web/api/geolocation/clearwatch/index.html create mode 100644 files/ja/web/api/geolocation/clearwatch/index.md delete mode 100644 files/ja/web/api/geolocation/getcurrentposition/index.html create mode 100644 files/ja/web/api/geolocation/getcurrentposition/index.md delete mode 100644 files/ja/web/api/geolocation/index.html create mode 100644 files/ja/web/api/geolocation/index.md delete mode 100644 files/ja/web/api/geolocation/watchposition/index.html create mode 100644 files/ja/web/api/geolocation/watchposition/index.md (limited to 'files/ja/web/api') diff --git a/files/ja/web/api/geolocation/clearwatch/index.html b/files/ja/web/api/geolocation/clearwatch/index.html deleted file mode 100644 index 5ae2a63e7f..0000000000 --- a/files/ja/web/api/geolocation/clearwatch/index.html +++ /dev/null @@ -1,95 +0,0 @@ ---- -title: Geolocation.clearWatch() -slug: Web/API/Geolocation/clearWatch -tags: - - API - - Geolocation - - Geolocation API - - Method - - Reference - - Secure context - - clearWatch - - メソッド - - リファレンス - - 位置情報 - - 位置情報 API - - 安全なコンテキスト -translation_of: Web/API/Geolocation/clearWatch ---- -

{{securecontext_header}}{{ APIref("Geolocation API") }}

- -

Geolocation.clearWatch()メソッドは、以前 {{domxref("Geolocation.watchPosition()")}} によって登録された位置情報/エラーの監視ハンドラーを解除するために使用します。

- -

構文

- -
navigator.geolocation.clearWatch(id);
- -

引数

- -
-
id
-
解除したいハンドラーの登録時に {{domxref("Geolocation.watchPosition()")}} メソッドから返された ID 番号です。
-
- -

- -
var id, target, option;
-
-function success(pos) {
-  var crd = pos.coords;
-
-  if (target.latitude === crd.latitude && target.longitude === crd.longitude) {
-    console.log('Congratulation, you reach the target');
-    navigator.geolocation.clearWatch(id);
-  }
-};
-
-function error(err) {
-  console.warn('ERROR(' + err.code + '): ' + err.message);
-};
-
-target = {
-  latitude : 0,
-  longitude: 0,
-}
-
-options = {
-  enableHighAccuracy: false,
-  timeout: 5000,
-  maximumAge: 0
-};
-
-id = navigator.geolocation.watchPosition(success, error, options);
-
- -

仕様書

- - - - - - - - - - - - - - - - -
仕様書状態備考
{{SpecName('Geolocation')}}{{Spec2('Geolocation')}}初回定義
- -

ブラウザーの互換性

- -

{{Compat("api.Geolocation.clearWatch")}}

- -

関連情報

- - diff --git a/files/ja/web/api/geolocation/clearwatch/index.md b/files/ja/web/api/geolocation/clearwatch/index.md new file mode 100644 index 0000000000..5ae2a63e7f --- /dev/null +++ b/files/ja/web/api/geolocation/clearwatch/index.md @@ -0,0 +1,95 @@ +--- +title: Geolocation.clearWatch() +slug: Web/API/Geolocation/clearWatch +tags: + - API + - Geolocation + - Geolocation API + - Method + - Reference + - Secure context + - clearWatch + - メソッド + - リファレンス + - 位置情報 + - 位置情報 API + - 安全なコンテキスト +translation_of: Web/API/Geolocation/clearWatch +--- +

{{securecontext_header}}{{ APIref("Geolocation API") }}

+ +

Geolocation.clearWatch()メソッドは、以前 {{domxref("Geolocation.watchPosition()")}} によって登録された位置情報/エラーの監視ハンドラーを解除するために使用します。

+ +

構文

+ +
navigator.geolocation.clearWatch(id);
+ +

引数

+ +
+
id
+
解除したいハンドラーの登録時に {{domxref("Geolocation.watchPosition()")}} メソッドから返された ID 番号です。
+
+ +

+ +
var id, target, option;
+
+function success(pos) {
+  var crd = pos.coords;
+
+  if (target.latitude === crd.latitude && target.longitude === crd.longitude) {
+    console.log('Congratulation, you reach the target');
+    navigator.geolocation.clearWatch(id);
+  }
+};
+
+function error(err) {
+  console.warn('ERROR(' + err.code + '): ' + err.message);
+};
+
+target = {
+  latitude : 0,
+  longitude: 0,
+}
+
+options = {
+  enableHighAccuracy: false,
+  timeout: 5000,
+  maximumAge: 0
+};
+
+id = navigator.geolocation.watchPosition(success, error, options);
+
+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('Geolocation')}}{{Spec2('Geolocation')}}初回定義
+ +

ブラウザーの互換性

+ +

{{Compat("api.Geolocation.clearWatch")}}

+ +

関連情報

+ + diff --git a/files/ja/web/api/geolocation/getcurrentposition/index.html b/files/ja/web/api/geolocation/getcurrentposition/index.html deleted file mode 100644 index dd24b126d3..0000000000 --- a/files/ja/web/api/geolocation/getcurrentposition/index.html +++ /dev/null @@ -1,93 +0,0 @@ ---- -title: Geolocation.getCurrentPosition() -slug: Web/API/Geolocation/getCurrentPosition -tags: - - API - - Geolocation - - Geolocation API - - Method - - Reference - - Secure context - - getCurrentPosition - - メソッド -translation_of: Web/API/Geolocation/getCurrentPosition ---- -

{{securecontext_header}}{{ APIRef("Geolocation API") }}

- -

Geolocation.getCurrentPosition() メソッドは、デバイスの現在位置を取得するために使われます。

- -

構文

- -
navigator.geolocation.getCurrentPosition(success[, error[, [options]])
- -

引数

- -
-
success
-
コールバック関数で、 {{domxref("GeolocationPosition")}} オブジェクトを唯一の入力引数として受け取るものです。
-
error {{optional_inline}}
-
任意のコールバック関数で、 {{domxref("GeolocationPositionError")}} オブジェクトを唯一の入力引数として受け取るものです。
-
options {{optional_inline}}
-
任意の {{domxref("PositionOptions")}} オブジェクトです。
- オプションには以下のものがあります。 -
    -
  • maximumAge: 整数 (ミリ秒) | infinity - キャッシュされた位置の最大寿命です。
  • -
  • timeout: 整数 (ミリ秒) - エラーコールバックが呼び出されるまでの時間で、 0 の場合は呼び出されません。
  • -
  • enableHighAccuracy: false | true
  • -
-
-
- -

- -
var options = {
-  enableHighAccuracy: true,
-  timeout: 5000,
-  maximumAge: 0
-};
-
-function success(pos) {
-  var crd = pos.coords;
-
-  console.log('Your current position is:');
-  console.log(`Latitude : ${crd.latitude}`);
-  console.log(`Longitude: ${crd.longitude}`);
-  console.log(`More or less ${crd.accuracy} meters.`);
-}
-
-function error(err) {
-  console.warn(`ERROR(${err.code}): ${err.message}`);
-}
-
-navigator.geolocation.getCurrentPosition(success, error, options);
-
- -

仕様書

- - - - - - - - - - - - - - - - -
仕様書状態備考
{{SpecName('Geolocation')}}{{Spec2('Geolocation')}}初回定義
- -

ブラウザーの互換性

- -

{{Compat("api.Geolocation.getCurrentPosition")}}

- -

関連情報

- - diff --git a/files/ja/web/api/geolocation/getcurrentposition/index.md b/files/ja/web/api/geolocation/getcurrentposition/index.md new file mode 100644 index 0000000000..dd24b126d3 --- /dev/null +++ b/files/ja/web/api/geolocation/getcurrentposition/index.md @@ -0,0 +1,93 @@ +--- +title: Geolocation.getCurrentPosition() +slug: Web/API/Geolocation/getCurrentPosition +tags: + - API + - Geolocation + - Geolocation API + - Method + - Reference + - Secure context + - getCurrentPosition + - メソッド +translation_of: Web/API/Geolocation/getCurrentPosition +--- +

{{securecontext_header}}{{ APIRef("Geolocation API") }}

+ +

Geolocation.getCurrentPosition() メソッドは、デバイスの現在位置を取得するために使われます。

+ +

構文

+ +
navigator.geolocation.getCurrentPosition(success[, error[, [options]])
+ +

引数

+ +
+
success
+
コールバック関数で、 {{domxref("GeolocationPosition")}} オブジェクトを唯一の入力引数として受け取るものです。
+
error {{optional_inline}}
+
任意のコールバック関数で、 {{domxref("GeolocationPositionError")}} オブジェクトを唯一の入力引数として受け取るものです。
+
options {{optional_inline}}
+
任意の {{domxref("PositionOptions")}} オブジェクトです。
+ オプションには以下のものがあります。 +
    +
  • maximumAge: 整数 (ミリ秒) | infinity - キャッシュされた位置の最大寿命です。
  • +
  • timeout: 整数 (ミリ秒) - エラーコールバックが呼び出されるまでの時間で、 0 の場合は呼び出されません。
  • +
  • enableHighAccuracy: false | true
  • +
+
+
+ +

+ +
var options = {
+  enableHighAccuracy: true,
+  timeout: 5000,
+  maximumAge: 0
+};
+
+function success(pos) {
+  var crd = pos.coords;
+
+  console.log('Your current position is:');
+  console.log(`Latitude : ${crd.latitude}`);
+  console.log(`Longitude: ${crd.longitude}`);
+  console.log(`More or less ${crd.accuracy} meters.`);
+}
+
+function error(err) {
+  console.warn(`ERROR(${err.code}): ${err.message}`);
+}
+
+navigator.geolocation.getCurrentPosition(success, error, options);
+
+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('Geolocation')}}{{Spec2('Geolocation')}}初回定義
+ +

ブラウザーの互換性

+ +

{{Compat("api.Geolocation.getCurrentPosition")}}

+ +

関連情報

+ + diff --git a/files/ja/web/api/geolocation/index.html b/files/ja/web/api/geolocation/index.html deleted file mode 100644 index 6bf37fa463..0000000000 --- a/files/ja/web/api/geolocation/index.html +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: Geolocation -slug: Web/API/Geolocation -tags: - - API - - Advanced - - Geolocation - - Geolocation API - - Interface - - Reference - - Secure context - - インターフェイス - - リファレンス - - 位置情報 - - 位置情報 API - - 安全なコンテキスト -translation_of: Web/API/Geolocation ---- -
{{securecontext_header}}{{APIRef("Geolocation API")}}
- -

Geolocation インターフェイスはデバイスの位置を取得する機能を提供します。これにより、ウェブサイトやアプリがユーザーの現在の位置に応じた結果を提供できるようになります。

- -

このインターフェイスを持つオブジェクトは、 {{domxref("Navigator")}} オブジェクトの {{domxref("navigator.geolocation")}} プロパティを使って得ることができます。

- -
-

注: セキュリティ上の理由により、ウェブページが位置情報にアクセスしようとする時、ユーザーにアクセス許可が求められます。その方法やポリシーはブラウザーによって異なることに注意してください。

-
- -

プロパティ

- -

Geolocation インターフェイスが実装・継承するプロパティはありません。

- -

メソッド

- -

Geolocation インターフェイスが継承するプロパティはありません。

- -
-
{{domxref("Geolocation.getCurrentPosition()")}} {{securecontext_inline}}
-
デバイスの現在位置を特定し、結果データを {{domxref("GeolocationPosition")}} オブジェクトで返します。
-
{{domxref("Geolocation.watchPosition()")}} {{securecontext_inline}}
-
デバイスの位置が変化する度に呼び出されるコールバック関数を登録し、それを識別する long 型の値を返します。
-
{{domxref("Geolocation.clearWatch()")}} {{securecontext_inline}}
-
watchPosition() によって以前に登録されたハンドラーを解除します。
-
- -

仕様書

- - - - - - - - - - - - - - - - -
仕様書状態備考
{{SpecName('Geolocation', '#geolocation_interface')}}{{Spec2('Geolocation')}}初回定義。
- -

ブラウザーの互換性

- -

{{Compat("api.Geolocation")}}

- -

関連情報

- - diff --git a/files/ja/web/api/geolocation/index.md b/files/ja/web/api/geolocation/index.md new file mode 100644 index 0000000000..6bf37fa463 --- /dev/null +++ b/files/ja/web/api/geolocation/index.md @@ -0,0 +1,73 @@ +--- +title: Geolocation +slug: Web/API/Geolocation +tags: + - API + - Advanced + - Geolocation + - Geolocation API + - Interface + - Reference + - Secure context + - インターフェイス + - リファレンス + - 位置情報 + - 位置情報 API + - 安全なコンテキスト +translation_of: Web/API/Geolocation +--- +
{{securecontext_header}}{{APIRef("Geolocation API")}}
+ +

Geolocation インターフェイスはデバイスの位置を取得する機能を提供します。これにより、ウェブサイトやアプリがユーザーの現在の位置に応じた結果を提供できるようになります。

+ +

このインターフェイスを持つオブジェクトは、 {{domxref("Navigator")}} オブジェクトの {{domxref("navigator.geolocation")}} プロパティを使って得ることができます。

+ +
+

注: セキュリティ上の理由により、ウェブページが位置情報にアクセスしようとする時、ユーザーにアクセス許可が求められます。その方法やポリシーはブラウザーによって異なることに注意してください。

+
+ +

プロパティ

+ +

Geolocation インターフェイスが実装・継承するプロパティはありません。

+ +

メソッド

+ +

Geolocation インターフェイスが継承するプロパティはありません。

+ +
+
{{domxref("Geolocation.getCurrentPosition()")}} {{securecontext_inline}}
+
デバイスの現在位置を特定し、結果データを {{domxref("GeolocationPosition")}} オブジェクトで返します。
+
{{domxref("Geolocation.watchPosition()")}} {{securecontext_inline}}
+
デバイスの位置が変化する度に呼び出されるコールバック関数を登録し、それを識別する long 型の値を返します。
+
{{domxref("Geolocation.clearWatch()")}} {{securecontext_inline}}
+
watchPosition() によって以前に登録されたハンドラーを解除します。
+
+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('Geolocation', '#geolocation_interface')}}{{Spec2('Geolocation')}}初回定義。
+ +

ブラウザーの互換性

+ +

{{Compat("api.Geolocation")}}

+ +

関連情報

+ + diff --git a/files/ja/web/api/geolocation/watchposition/index.html b/files/ja/web/api/geolocation/watchposition/index.html deleted file mode 100644 index cb7f4b91a4..0000000000 --- a/files/ja/web/api/geolocation/watchposition/index.html +++ /dev/null @@ -1,97 +0,0 @@ ---- -title: Geolocation.watchPosition() -slug: Web/API/Geolocation/watchPosition -tags: - - API - - Geolocation - - Geolocation API - - Method - - Reference - - Secure context -translation_of: Web/API/Geolocation/watchPosition ---- -

{{securecontext_header}}{{ APIref("Geolocation API") }}

- -

{{domxref("Geolocation")}} の watchPosition() メソッドは、端末の位置が変化するたびに自動的に呼び出されるハンドラー関数を登録するために用いられます。また必要に応じてエラー処理コールバック関数を指定することができます。

- -

構文

- -
navigator.geolocation.watchPosition(success[, error[, options]])
- -

引数

- -
-
success
-
コールバック関数で、 {{domxref("GeolocationPosition")}} オブジェクトを入力引数として受け取るものです。
-
error {{optional_inline}}
-
任意のコールバック関数で、 {{domxref("GeolocationPositionError")}} オブジェクトを入力引数として受け取るものです。
-
options {{optional_inline}}
-
任意の {{domxref("PositionOptions")}} オブジェクトで、位置を監視する構成オプションを提供します。
-
- -

返値

- -

登録されたハンドラーを識別する ID を返します。この ID を {{domxref("Geolocation.clearWatch()")}} メソッドに渡してハンドラーの登録を解除することができます。

- -

- -
var id, target, options;
-
-function success(pos) {
-  var crd = pos.coords;
-
-  if (target.latitude === crd.latitude && target.longitude === crd.longitude) {
-    console.log('Congratulations, you reached the target');
-    navigator.geolocation.clearWatch(id);
-  }
-}
-
-function error(err) {
-  console.warn('ERROR(' + err.code + '): ' + err.message);
-}
-
-target = {
-  latitude : 0,
-  longitude: 0
-};
-
-options = {
-  enableHighAccuracy: false,
-  timeout: 5000,
-  maximumAge: 0
-};
-
-id = navigator.geolocation.watchPosition(success, error, options);
-
- -

仕様書

- - - - - - - - - - - - - - - - -
仕様書状態備考
{{SpecName('Geolocation', '#dom-geolocation-watchposition', 'watchPosition()')}}{{Spec2('Geolocation')}}初回定義
- -

ブラウザーの互換性

- -

{{Compat("api.Geolocation.watchPosition")}}

- -

関連情報

- - diff --git a/files/ja/web/api/geolocation/watchposition/index.md b/files/ja/web/api/geolocation/watchposition/index.md new file mode 100644 index 0000000000..cb7f4b91a4 --- /dev/null +++ b/files/ja/web/api/geolocation/watchposition/index.md @@ -0,0 +1,97 @@ +--- +title: Geolocation.watchPosition() +slug: Web/API/Geolocation/watchPosition +tags: + - API + - Geolocation + - Geolocation API + - Method + - Reference + - Secure context +translation_of: Web/API/Geolocation/watchPosition +--- +

{{securecontext_header}}{{ APIref("Geolocation API") }}

+ +

{{domxref("Geolocation")}} の watchPosition() メソッドは、端末の位置が変化するたびに自動的に呼び出されるハンドラー関数を登録するために用いられます。また必要に応じてエラー処理コールバック関数を指定することができます。

+ +

構文

+ +
navigator.geolocation.watchPosition(success[, error[, options]])
+ +

引数

+ +
+
success
+
コールバック関数で、 {{domxref("GeolocationPosition")}} オブジェクトを入力引数として受け取るものです。
+
error {{optional_inline}}
+
任意のコールバック関数で、 {{domxref("GeolocationPositionError")}} オブジェクトを入力引数として受け取るものです。
+
options {{optional_inline}}
+
任意の {{domxref("PositionOptions")}} オブジェクトで、位置を監視する構成オプションを提供します。
+
+ +

返値

+ +

登録されたハンドラーを識別する ID を返します。この ID を {{domxref("Geolocation.clearWatch()")}} メソッドに渡してハンドラーの登録を解除することができます。

+ +

+ +
var id, target, options;
+
+function success(pos) {
+  var crd = pos.coords;
+
+  if (target.latitude === crd.latitude && target.longitude === crd.longitude) {
+    console.log('Congratulations, you reached the target');
+    navigator.geolocation.clearWatch(id);
+  }
+}
+
+function error(err) {
+  console.warn('ERROR(' + err.code + '): ' + err.message);
+}
+
+target = {
+  latitude : 0,
+  longitude: 0
+};
+
+options = {
+  enableHighAccuracy: false,
+  timeout: 5000,
+  maximumAge: 0
+};
+
+id = navigator.geolocation.watchPosition(success, error, options);
+
+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('Geolocation', '#dom-geolocation-watchposition', 'watchPosition()')}}{{Spec2('Geolocation')}}初回定義
+ +

ブラウザーの互換性

+ +

{{Compat("api.Geolocation.watchPosition")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf