diff options
author | julieng <julien.gattelier@gmail.com> | 2021-10-02 17:20:24 +0200 |
---|---|---|
committer | SphinxKnight <SphinxKnight@users.noreply.github.com> | 2021-10-02 17:30:20 +0200 |
commit | 1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde (patch) | |
tree | 30a56efd3eff3a01bd1611e1840fdbbfacf544a4 /files/fr/web/api/geolocation/getcurrentposition | |
parent | c05efa8d7ae464235cf83d7c0956e42dc6974103 (diff) | |
download | translated-content-1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde.tar.gz translated-content-1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde.tar.bz2 translated-content-1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde.zip |
convert content to md
Diffstat (limited to 'files/fr/web/api/geolocation/getcurrentposition')
-rw-r--r-- | files/fr/web/api/geolocation/getcurrentposition/index.md | 87 |
1 files changed, 35 insertions, 52 deletions
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 --- -<div>{{securecontext_header}}{{APIRef("Geolocation API")}}</div> +{{securecontext_header}}{{APIRef("Geolocation API")}} -<p>La méthode <strong><code>Geolocation.getCurrentPosition()</code></strong> fournit la position actuelle de l'appareil.</p> +La méthode **`Geolocation.getCurrentPosition()`** fournit la position actuelle de l'appareil. -<h2 id="Syntaxe">Syntaxe</h2> +## Syntaxe -<pre class="syntaxbox">navigator.geolocation.getCurrentPosition(<em>success[</em>, <em>error[</em>, <em>[options]]</em>)</pre> + navigator.geolocation.getCurrentPosition(success[, error[, [options]]) -<h3 id="Paramètres">Paramètres</h3> +### Paramètres -<dl> - <dt><code>success</code></dt> - <dd>Une fonction de rappel qui prend un objet {{domxref("Position")}} comme argument.</dd> - <dt><code>error</code> {{optional_inline}}</dt> - <dd>Une fonction de rappel qui prend un objet {{domxref("PositionError")}} comme argument.</dd> - <dt><code>options</code> {{optional_inline}}</dt> - <dd>Un objet {{domxref("PositionOptions")}} optionnel. Les options décrites par cet objet sont : - <ul> - <li><code>maximumAge</code> : 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.</li> - <li><code>timeout</code> : un entier qui exprime la durée, en millisecondes, avant que la fonction de rappel <code>error</code> soit appelé. Si cette propriété vaut <code>0</code>, la fonction d'erreur ne sera jamais appelée.</li> - <li><code>enableHighAccuracy</code> : un booléen qui indique si une précision élevée est requise.</li> - </ul> - </dd> -</dl> +- `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}} -<h2 id="Exemples">Exemples</h2> + - : Un objet {{domxref("PositionOptions")}} optionnel. Les options décrites par cet objet sont : -<pre class="brush: js">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); -</pre> - -<h2 id="Spécifications">Spécifications</h2> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Spécification</th> - <th scope="col">État</th> - <th scope="col">Commentaires</th> - </tr> - </thead> - <tbody> - <tr> - <td>{{SpecName('Geolocation')}}</td> - <td>{{Spec2('Geolocation')}}</td> - <td>Spécification initiale.</td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> - -<p>{{Compat("api.Geolocation.getCurrentPosition")}}</p> - -<h2 id="Voir_aussi">Voir aussi</h2> - -<ul> - <li><a href="/en-US/docs/WebAPI/Using_geolocation">Utiliser la géolocalisation</a></li> - <li>{{domxref("Navigator.geolocation")}}</li> -</ul> +``` + +## 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")}} |