You will need an ip address for searching the location of any user, anyhow, check out an alternative structure for the functions that uses IP geolocation of google for fallback:
Code:
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(updatePosition, ipPosition, { options... });
} else {
ipPosition();
}
function ipPosition() {
updatePosition(google.loader.ClientLocation);
}
function updatePosition(position) {
if (position == null) {
return updatePosition(defaultPlace());
}
// Firefox 3.6 passes in a non-standard position object with lat/lng at the top level instead of in .coords
var coords = (position.hasOwnProperty("coords")) ? position.coords : position;
if (coords == null) {
return updatePosition(defaultPlace());
}
[...]
}
Bookmarks