I am adding geolocation capability to my google maps application. here
are my code for reading current position
// Try W3C Geolocation method (Preferred)
if(navigator.geolocation) {
browserSupportFlag = true;
navigator.geolocation.getCurrentPosition(function(position) {
initialLocation = new
google.maps.LatLng(position.coords.latitude,position.coords.longitude);
}, function() {
handleNoGeolocation(browserSupportFlag, 1);
}, { enableHighAccuracy: true });
} else if (google.gears) {
// Try Google Gears Geolocation
browserSupportFlag = true;
var geo = google.gears.factory.create('beta.geolocation');
geo.getCurrentPosition(function(position) {
initialLocation = new
google.maps.LatLng(position.latitude,position.longitude);
}, function() {
handleNoGeolocation(browserSupportFlag, 2);
});
} else {
// Browser doesn't support Geolocation
browserSupportFlag = false;
handleNoGeolocation(browserSupportFlag, 0);
}
I am testing on Desktop computer that don't have gps device attached,
so it probably use ip address to locate my position
the strange thing is if i run this code on IE, it seem give better
result than firefox. Is there any reason for this things.
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.