Matt Wilko
Matt Wilko

Reputation: 27342

HTML Geolocation on Android Doesn't Prompt

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)

Upvotes: 0

Views: 1975

Answers (1)

RPB
RPB

Reputation: 16340

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

Upvotes: 2

Related Questions