2011-07-11 28 views
0

爲什麼Google API加載程序客戶端地址位置爲多年工作的國家返回空字符串? 對象在這裏,但地址項是空的。google.loader.ClientLocation爲地址項返回emply字符串

API鍵後。

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 

回答

0

Google.load.ClientLocation不再被谷歌團隊開發支持。 load.ClientLocation僅返回非常不準確的經度和緯度,並且沒有更多地址項目。

這非常糟糕,因爲現在如果用戶不接受使用HTML5返回地理位置,則需要使用IP位置來搜索國家和城市。

我認爲這是一個像谷歌這樣的偉大公司的非常自我主義者,很多網站需要爲內容提供識別城市,國家,語言的最低限度和ClientLocation函數這是一個更簡單的方法。現在要做到這一點,您需要調用導航器詢問用戶,獲取經緯度,並使用外部呼叫到另一個服務來查看簡單的國家代碼!這不是爲了簡化我的應用程序。國家或城市的位置不像100米的GPS位置這是許多開發者的基本功能。乾杯。

參見: