Search code examples
javascriptleafletgeolocationfrontendlocation

Geolocation API gives me wrong locations


I started to build a project, that has a map of where the uses are living and it can help them to set workouts places, pretty simple, you can see the demo right here. I used Geolocation API and Leaflet library to make it.

And some beginning days, it displayed correctly the city where im living, but a few days ago, when I open it, it gives me wrong location, wrong city, which is about 90km away from my city. And today, I got a second wrong location, which is more 300km away.

I checked on other browser and it also has the same problems. I used my phone to check the location, it appears very true, even my phone and my computer use the same Wifi.

Please help me, i know that this question asked many times on Stack Overflow, but i didn't get helped. Im not sure if im undercontrolled by hackers or not, your answers are very important to me, thank you very very much readers.


Solution

  • I'm not sure what your question is.

    When asking a Geolocation on a computer it is going to be less accurate. Your smartphone has more sensors and GPS. It will give a more accurate location.