Geolocation API Methods

The geolocation API exists inside the navigator object and contains only three methods to determine the user’s current position and also get notified of changes to their position.


  1. getCurrentPosition
  2. watchPosition
  3. clearWatch



MethodDescription
getCurrentPositiona one-shot method for grabbing the user’s current location.
watchPositionReturns the user’s current location but continues to monitor their position and keeps polling at regular intervals to see if their location has changed and invoke the appropriate callback every time the position changes.
clearWatchThis method ends the watchPosition method's monitoring of the current
position.


The watchPosition and clearWatch are paired methods. watchPosition returns a unique identifier that is passed in to clearWatch to clear that particular watch.
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +