Geolocation cached positions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Request a position. We accept positions whose age is not | |
// greater than 10 minutes. If the user agent does not have a | |
// fresh enough cached position object, it will automatically | |
// acquire a new one. | |
navigator.geolocation.getCurrentPosition(successCallback, | |
errorCallback, | |
{maximumAge:600000}); | |
function successCallback(position) { | |
// By using the 'maximumAge' option above, the position | |
// object is guaranteed to be at most 10 minutes old. | |
} | |
function errorCallback(error) { | |
// Update a div element with error.message. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment