问题
Why Google API Loader Client adress location is returning an empty string for a working country for years?. The object is here but adresses items are empty.
After API key.
google.load("maps",'3',{other_params:'sensor=true'});
google.setOnLoadCallback(function()
{
if (google.loader.ClientLocation)
{
google.loader.ClientLocation.address.city is ""
google.loader.ClientLocation.address.region is ""
google.loader.ClientLocation.address.country_code is ""
google.loader.ClientLocation.latitude is OK
google.loader.ClientLocation.longitude is OK
回答1:
Google.load.ClientLocation is no more supported by google team dev. The load.ClientLocation is only returning a very bad accurate latitude and longitude and no more addresses items.
This is very bad because now if user not accepting to return geolocation using HTML5, you need to use IPlocation to search a country and city.
I think that is very egoist from a great company like Google, many websites need to serve contents identifiing cities, countries, languages as a minimal and ClientLocation function it was a easier way. Now to make this, you need to call navigators ask to users, get the lat,lon and get use an external call to another service to see a simple country code!. It's not to simplify my applications. Country or city locations in not like GPS position at 100 m It's a basic fonction of many developers an users. Cheers.
See:
- Is google.loader.clientlocation still supported
来源:https://stackoverflow.com/questions/6655623/google-loader-clientlocation-returning-emply-strings-for-adress-items