JavaScript Geolocation getCurrentPosition() Method
JavaScript Geolocation getCurrentPosition() Method
The getCurrentPosition() method is used to return the current position of the device.
Syntax:-
Its syntax is:- navigator.geolocation.getCurrentPosition(success, error, options)
Return:-
Its return is:- current position of the device
Further Explanation:-
Parameter | Description |
---|---|
success | Required. A callback function that takes a Position object as its sole input parameter |
error | Optional. A callback function that takes a PositionError object as its sole input parameter |
options | Optional. A PositionOptions object |