HTML5 GeoLocation-Geolocation getCurrentPosition() API - HTML 5

What is use of getCurrentPosition() method?

Description

GetCurrentPosition method is used for retrieving current geographic location of the device and the location is expressed as a set of geographic coordinates along with heading and speed. Location information is returned in a Position object.

Syntax

Below is the syntax for this method

getCurrentPosition(showLocation, ErrorHandler, options);

Parameters

Detail of parameters are given below

  • showLocation − showLocation is called asynchronously with an object corresponding to the Position object used for storing the returned location information and describes a callback method for retrieving the location information.
  • ErrorHandler − ErrorHandler is an optional parameter called with the PositionError object that stores the returned error information and is used to specify the callback method invoked when an error occurs while processing the asynchronous call.
  • options − options is an optional parameter used to specify a set of options to retrieve the location information. 3 options can be specified such as (a) Accuracy of the returned location information (b) Timeout for retrieving the location information and (c) Use of cached location information.

Return value

GetCurrentPosition method does not return a value.

Example

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

HTML 5 Topics