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.

code

Summary

The error code of the current PositionError.

Property of apis/geolocation/PositionErrorapis/geolocation/PositionError

Syntax

Note: This property is read-only.

var result = PositionError.code;

Return Value

Returns an object of type NumberNumber

Must be one of the following constant values:

  • PERMISSION_DENIED (numeric value 1): The location acquisition process failed because the document does not have permission to use the Geolocation API.
  • POSITION_UNAVAILABLE (numeric value 2): The position of the device could not be determined. For instance, one or more of the location providers used in the location acquisition process reported an internal error that caused the process to fail entirely.
  • TIMEOUT (numeric value 3): The length of time specified by the timeout property has elapsed before the implementation could successfully acquire a new Position object.

Examples

alert(PositionError.code);

Related specifications

W3C Geolocation Specification
W3C Editor’s Draft

Attributions