Discussion on HTML5 Geolocation with Address decoding


smart_techie does not currently provide support for this item.

17 comments found.

Good script.

I have a question. On the video it’s not clear how you handle exception (when user denied share location).

how you get location in this case?


Hello damirg,

The error is checked by checking the status, in the video / screenshot you can see that the code is checking for

data.status == "ok"
otherwise we are displaying the error message
When the user explicitly denies a location access request, the script will trigger a soft error where you can decide how you want to handle ex.. displaying a message to user. But in any case it won’t get a location as that would mean to breach the privacy.

Hope this helped.


This screenshot has the implementation, https://0.s3.envato.com/files/95286675/6.png

I got your point now… I beleive that you will use another way to track location. Thanks!

Never tested? But it’s native JS so probably should work

Nice work!! Good luck! :)

Thank you .. :)

Hi – I am unable to get the weather page working and get following on every browser instead of actual weather report as seen on your screen shots

[object Object]

Need urgent help!

Where are you using it? Can i get some link for the page you are using this on?

HTML5 Geolocation with Address decoding Can you give me a link where I can test this program with my android? When I visit the site I will like to get the Latitude and Longitude of my location with android. I have been having problems in acquiring a script that gives me exact location. If it gives me exact location I will buy it. Thanks.

Sorry there isn’t any hosted demo. It basically uses HTML5 geolocation to triangulate the location so as long as the browser provides a good lock it should be good with the script as well.

Give this one a try, see if you get a accurate lock http://html5demos.com/geo

Question: Can you tell us what the data return field would be for the street without the exact street address number?

thank you

I’d like to use this on my site. I want them to click on a picture and have their town automatically loaded within the search field. Is this possible with this script?

That should be perfectly possible. You can see it in the demo here @2:57 https://youtu.be/vWf8e7LVxco?t=2m57s

im trying to figure out how to save setting in a page

function(data) {
                   // Callback when the decoded address is available
                   if (data.status === "ok") {
                       $.get( "_storelocation.asp?ycountryname=1", true);
                       document.getElementById("address").innerHTML = data.address;

any ideas?

ok im trying to after the a member/visitor visit the site and agree to geolocation, use the get/POST protocol to store that info (Country,state,city, longitude,latitude, etc) into my database, so I can customize my site for local members :)

function(data) { // Callback when the decoded address is available if (data.status === “ok”) { document.getElementById(“address”).innerHTML = data.address; document.getElementById(“locality”).innerHTML = “Locality: ” + data.locality; document.getElementById(“state”).innerHTML = “State: ” + data.state; document.getElementById(“country”).innerHTML = “Country: ” + data.country; document.getElementById(“zip”).innerHTML = “Zip: ” + data.zip; xmlHttp.open( “GET”, “_storelocation.asp?ycountryname=1”, true ); xmlHttp.send(); } else { document.getElementById(“address”).innerHTML = “Error: ” + message; alert(data.message); }

i used something like this to for my users facebook login function loadfblogin() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("fbDiv").innerHTML=xmlhttp.responseText; } } FB.api('/me', function(response) { console.log(JSON.stringify(response)); <% If rsUser.EOF And rsUser.BOF Then %> xmlhttp.open("GET","fblogin.asp?fbuserid=" + response.id + "&email=" + response.email + "&firstname=" + response.first_name + "&lastname=" + response.last_name + "",true); xmlhttp.send(); self.location="fblogin2.asp?fbuserid=" + response.id + ""; <% End If ' end rsUser.EOF And rsUser.BOF %>

so im hoping to use something similar with this

Sorry my last message was confusing, im just looking for a GET Function to save the geo data, since im new at this after 3 days still unsuccessful

}, function(data) { // Callback when the decoded address is available if (data.status === "ok") { var address = data.address; var area = data.locality; var state = data.state; var country = data.country; var zip = data.zip; var theUrl = "http://edmshare.com/_storelocation.asp?geocountry=" + data.zip; } else { document.getElementById("address").innerHTML = "Error: " + message; alert(data.message); } }); xmlHttp.open( "GET", theUrl, true ); xmlHttp.send( null ); return xmlHttp.responseText; // Handles the error when the user denies the location access }

Hi vallowens, sorry about the delay. Were you able to get it to work?

no sir i wasnt able to figure it out but, itll would be a nice include into an update

Hello and thank you for your script that I just bought. However the display of the weather not walk. Im returns me an error: “Uncaught TypeError: Can not read property ‘channel’ of null” can you give me a correction solution? Thank you for your reply

Great item, thank you for this great code. I have come across an issue and can’t seem to figure out what is wrong. On some of my machines, this code works perfectly. On others, I get “user has denied access to geolocation” error. I have checked that the location privacy has been set to allow all sites, but it still seems to give error. Any ideas on how to correct this? It happens in chrome and firefox.

Hello, Lets say I wanna show all tracking on a big map is it possible?

This code works fine using Chrome(need ssl) and Firefox. But failed on Safari Version 9.1.2 (10601.7.7). Please advise. Thanks!

Great Work! Good Luck!!!

Is this unsupported? I see questions here unanswered. Please advise.

is this using google maps api? Need it to work in China for reverse address lookup and China blocked all google traffic. Thx.