HTML DOM Geolocation coords.altitudeAccuracy Property (original) (raw)

Last Updated : 23 Jul, 2025

In this article, we will discuss the Geolocation altitudeAccuracy property. Geolocation in HTML is used to get the geographical position of a user. The getCurrentPosition() method, in this geolocation, returns an object on success.

coords.altitudeAccuracy: This property will return the accuracy position if available in meters above sea level.

Syntax:

coords.altitudeAccuracy

Example: The following HTML code will return the altitudeAccuracy property.

HTML `

GeeksforGeeks

Displaying AltitudeAccuracy

<button onclick="getlocation()"> Click Me </button>
<p id="paraID"></p>

<script>
  var variable1 = document.getElementById("paraID");

  function getlocation() {
      navigator.geolocation.getCurrentPosition(showLoc);
  }

  function showLoc(pos) {
      variable1.innerHTML = "AltitudeAccuracy: "
                         + pos.coords.altitudeAccuracy;
  }
</script>

`

Output:

Supported Browsers: