javascriptgoogle-mapsgoogle-chromegoogle-maps-api-3geolocation

Chrome geolocation in iran


I'm using simple javascript code to get the user lcoation :

function getLocation() {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(showPosition);
  } else {
    x.innerHTML = "Geolocation is not supported by this browser.";
  }
}

But because of the boycott of Google APIs in iran , we can't access geolocation from the chrome browser(Mozilla Browser is ok and the mobile apps has no issues because use the mobile gps) and as far as i know get user location from the ip address is not a good idea because its return the user isp location.

Is there any solution for this? for example can i use proxy before getting the location?

Thanks.


Solution

  • According to the research I did , there is no way to do that you can just use the databases that have latitude and longitude . And get the province , city , district and show the approximate location to user. Its not the best idea but at least is an idea.

    I prepared iran-provinces-cities-neighbourhoods-geo database in for mysql and you can use it :).