This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

accuracy

Summary

Denotes the accuracy level of the latitude and longitude coordinates. It is specified in meters and must be supported by all implementations. The value of this attribute must be a non-negative real number.

Property of apis/geolocation/Coordinatesapis/geolocation/Coordinates

Syntax

Note: This property is read-only.

var result = Coordinates.accuracy;

Return Value

Returns an object of type NumberNumber

Examples

//Assuming the variable accuracy_threshold has been set
if (position.coords.accuracy < accuracy_threshold) {
   // The position is relatively accurate.
   } else {
   // The position is potentially inaccurate.
   }

Related specifications

W3C Geolocation Specification
W3C Editor’s Draft

Attributions