2
我發現在這個代碼與谷歌 地理位置決心的腳本有是86字符長谷歌API不工作的地理位置
我已經打開了該網站 的Gmail的一個谷歌API密鑰的密鑰它是一個短鍵(只有39個字符)
然後我改變了密鑰並運行代碼。
我得到我需要的解析國家位置。 我然後嘗試從另一個IP位置(在家中)和一個代理服務器,並沒有得到任何東西
我不知道如果我使用的API密鑰是公開或不公開 - 如何我檢查嗎? 我必須付費才能使用它,或者每天只能使用免費的25,000個請求嗎?
我已經嘗試的代碼是:
<script type="text/javascript" src="http://www.google.com/jsapi?key="></script>
<script type="text/javascript">
function geoTest() {
if (google.loader.ClientLocation) {
var latitude = google.loader.ClientLocation.latitude;
var longitude = google.loader.ClientLocation.longitude;
var city = google.loader.ClientLocation.address.city;
var country = google.loader.ClientLocation.address.country;
var country_code = google.loader.ClientLocation.address.country_code;
var region = google.loader.ClientLocation.address.region;
var text = 'Your Location<br /><br />Latitude: ' + latitude + '<br />Longitude: ' + longitude + '<br />City: ' + city + '<br />Country: ' + country + '<br />Country Code: ' + country_code + '<br />Region: ' + region;
} else {
var text = 'Google was not able to detect your location';
}
document.write(text);
}
geoTest();
</script>
如果你打開URL'http://www.google.com/jsapi ?key ='直接在你的瀏覽器中,第13行說的是什麼? – YuS 2012-02-22 10:39:45
in line 13 it says:null,but give me the location with the IP with i used when opened api for the email account – 2012-02-22 11:31:34
您是否使用過筆記本電腦?它可能是一個緩存問題呢? – YuS 2012-02-22 16:25:36