Current location can be tracked using the following API:
navigator.geolocation.getCurrentPosition(PositionCallBack successCallBack,
optional PositionErrorCallback errorCallBack,
optional PositionOptions options)
The first parameter to the API is a call back event, which means on identifying the location, this particular event would be called.
Similarly on error, PositionErrorCallback function would be executed. Also, we can configure this API by setting the position Options.
GeoLocation API Documentation gives more insight on tracking the location Note: Tracking location is a security concern. On chrome, you may need to disable the web security for the code to run.
No comments:
Post a Comment