0

I am doing some research into geolocation in web pages.

I have set up a basic (ASP.NET) page just to retrieve the lat and long. Here is a snippet of the javascript code I am using in that page:

function showPosition(position) {
    var latlondata = position.coords.latitude + "," + position.coords.longitude;
    var latlon = "Your Latitude Position is:=" + position.coords.latitude + "," + "Your Longitude Position is:=" + position.coords.longitude;
    x.innerHTML = latlon;

    var img_url = "http://maps.googleapis.com/maps/api/staticmap?center="  + latlondata + "&zoom=14&size=400x300&sensor=false";
    document.getElementById("mapholder").innerHTML = "<img src='" + img_url + "' />";
}

function showError(error) {
    if (error.code == 1) {
        x.innerHTML = "User denied the request for Geolocation."
    }
    else if (err.code == 2) {
        x.innerHTML = "Location information is unavailable."
    }
    else if (err.code == 3) {
        x.innerHTML = "The request to get user location timed out."
    }
    else {
        x.innerHTML = "An unknown error occurred."
    }
}

However when I try this on my android device (HTC Wildfire). It reports "Used denied the request for Geolocation", but I don't see any prompt on my phone.

Is this something I am doing wrong in the code or on my phone (or both)

Matt Wilko
  • 26,994
  • 10
  • 93
  • 143

1 Answers1

2

I think you have to set setting inside your browser, For Implementation change Visit this link

Community
  • 1
  • 1
RPB
  • 16,006
  • 16
  • 55
  • 79
  • 1
    You are correct it is a setting on the browser (`Menu>More>Settings>Enable Location`). Your answer pointed me in the right direction. – Matt Wilko Jun 29 '12 at 08:28