I'm having trouble getting a map to locate the user who is requesting
my web page. I found a tutorial on how to do this for someone who is
using a computer instead of a cell phone, but I can't find that
tutorial anymore. Here is the code I'm using, maybe the answer is in
my syntax. Thanks for the help in advance:
var latitude = '';
var longitude = '';
function getLocation(pos)
{
latitude = pos.coords.latitude;
longitude = pos.coords.longitude;
load_map();
}
function unknownLocation(){alert('Could not find location');}
function detect_load(){
navigator.geolocation.getCurrentPosition(getLocation,
unknownLocation);
}
function load_map() {
if(latitude == '' || longitude == '')
return false;
var latlng = new google.maps.LatLng(latitude, longitude);
var config = {
zoom: 11,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new
google.maps.Map(document.getElementById("map"),config);
}
Any help would be appreciated.
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.