From 1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde Mon Sep 17 00:00:00 2001 From: julieng Date: Sat, 2 Oct 2021 17:20:24 +0200 Subject: convert content to md --- .../api/geolocation/getcurrentposition/index.md | 87 +++++++++------------- 1 file changed, 35 insertions(+), 52 deletions(-) (limited to 'files/fr/web/api/geolocation/getcurrentposition') diff --git a/files/fr/web/api/geolocation/getcurrentposition/index.md b/files/fr/web/api/geolocation/getcurrentposition/index.md index 8168640a6c..a2d19748da 100644 --- a/files/fr/web/api/geolocation/getcurrentposition/index.md +++ b/files/fr/web/api/geolocation/getcurrentposition/index.md @@ -8,34 +8,32 @@ tags: - Reference translation_of: Web/API/Geolocation/getCurrentPosition --- -
{{securecontext_header}}{{APIRef("Geolocation API")}}
+{{securecontext_header}}{{APIRef("Geolocation API")}} -

La méthode Geolocation.getCurrentPosition() fournit la position actuelle de l'appareil.

+La méthode **`Geolocation.getCurrentPosition()`** fournit la position actuelle de l'appareil. -

Syntaxe

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

Paramètres

+### Paramètres -
-
success
-
Une fonction de rappel qui prend un objet {{domxref("Position")}} comme argument.
-
error {{optional_inline}}
-
Une fonction de rappel qui prend un objet {{domxref("PositionError")}} comme argument.
-
options {{optional_inline}}
-
Un objet {{domxref("PositionOptions")}} optionnel. Les options décrites par cet objet sont : -
    -
  • maximumAge : un entier qui exprime une durée en millisecondes ou l'infini pour indiquer la durée maximale pendant laquelle mettre en cache la position.
  • -
  • timeout : un entier qui exprime la durée, en millisecondes, avant que la fonction de rappel error soit appelé. Si cette propriété vaut 0, la fonction d'erreur ne sera jamais appelée.
  • -
  • enableHighAccuracy : un booléen qui indique si une précision élevée est requise.
  • -
-
-
+- `success` + - : Une fonction de rappel qui prend un objet {{domxref("Position")}} comme argument. +- `error` {{optional_inline}} + - : Une fonction de rappel qui prend un objet {{domxref("PositionError")}} comme argument. +- `options` {{optional_inline}} -

Exemples

+ - : Un objet {{domxref("PositionOptions")}} optionnel. Les options décrites par cet objet sont : -
var options = {
+    - `maximumAge` : un entier qui exprime une durée en millisecondes ou l'infini pour indiquer la durée maximale pendant laquelle mettre en cache la position.
+    - `timeout` : un entier qui exprime la durée, en millisecondes, avant que la fonction de rappel `error` soit appelé. Si cette propriété vaut `0`, la fonction d'erreur ne sera jamais appelée.
+    - `enableHighAccuracy` : un booléen qui indique si une précision élevée est requise.
+
+## Exemples
+
+```js
+var options = {
   enableHighAccuracy: true,
   timeout: 5000,
   maximumAge: 0
@@ -55,34 +53,19 @@ function error(err) {
 }
 
 navigator.geolocation.getCurrentPosition(success, error, options);
-
- -

Spécifications

- - - - - - - - - - - - - - - - -
SpécificationÉtatCommentaires
{{SpecName('Geolocation')}}{{Spec2('Geolocation')}}Spécification initiale.
- -

Compatibilité des navigateurs

- -

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

- -

Voir aussi

- - +``` + +## Spécifications + +| Spécification | État | Commentaires | +| ------------------------------------ | -------------------------------- | ----------------------- | +| {{SpecName('Geolocation')}} | {{Spec2('Geolocation')}} | Spécification initiale. | + +## Compatibilité des navigateurs + +{{Compat("api.Geolocation.getCurrentPosition")}} + +## Voir aussi + +- [Utiliser la géolocalisation](/en-US/docs/WebAPI/Using_geolocation) +- {{domxref("Navigator.geolocation")}} -- cgit v1.2.3-54-g00ecf