PositionError
Summary
The container for Position error information returned by this API.
Properties
- code
- The error code of the current PositionError.
- message
- The error text of the current PositionError, describing the details of the error encountered. This attribute is primarily intended for debugging and developers should not use it directly in their application user interface.
Methods
No methods.
Events
No events.
Examples
Displays error with detailed information.
navigator.geolocation.getCurrentPosition(geoSuccess,geoError);
/* Position found*/
function geoSuccess(position)
{
alert("Position found.");
}
/* Position not found*/
function geoError(err)
{
if(err.code == 0)
{alert("Error: Unknown error");}
else if( err.code == 2)
{alert("Error: Permission denied");}
else if( err.code == 2)
{alert("Error: Position not available");}
else if( err.code == 3)
{alert("Error: Timeout");}
else
{alert(err.message);}
}
Related specifications
- W3C Geolocation Specification
- W3C Editor’s Draft
Attributions
This article contains content originally from external sources, including ones licensed under the CC-BY-SA license.
Portions of this content copyright 2012 Mozilla Contributors. This article contains work licensed under the Creative Commons Attribution-Sharealike License v2.5 or later. The original work is available at Mozilla Developer Network: Article
Microsoft Developer Network: Windows Internet Explorer API reference Article