谷歌api不适用于地理定位
google api not working for geolocation
我在谷歌上找到了一个地理位置解析脚本在这个代码中有一个密钥是86个字符长的
我已经为该网站的gmail打开了一个googleapi密钥这是一个短密钥(只有39个字符)
然后我更改了密钥并运行代码。
我得到了我需要的决心所在的国家。然后我尝试从另一个ip位置(在家里)和一个有代理服务器的位置,但没有得到任何东西
我不确定我使用的api密钥是否设置为public-我该如何检查?我必须为使用它付费吗?还是只能在每天25000次免费请求的情况下使用?
我尝试过的代码是:
<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>
似乎地理位置不可靠请点击此处查看Philippe的答案谷歌下载客户端位置是否仍然支持
相关文章:
- JQueryhide()不适用于Mozzilla,但适用于Chrome
- PHP中的setcookie仅适用于localhost
- 绝对定位不适用于Javascript DIV
- html5 drawImage适用于firefox,而不是chrome
- 提供“;onClick"适用于iPad(触摸屏)和桌面用户的默认功能
- jQuery表单验证适用于Mozilla和Internet Explorer,但不适用于Chrome或Safari
- ResolveUrl是否适用于././也
- Firebase updateChildValues适用于IOS,但不适用于Web和Android
- JavaScript警报适用于int,但不适用于string
- SQLite插件适用于Mac和Windows,但不适用于手机上的Safari
- Regex Replace仅适用于Last Match
- window.onload适用于aspx页面,但不适用于普通html
- Jquery Ajax POST不工作.适用于GET
- 画布上的自定义字体仅适用于safari
- Javascript仅适用于alert()和Debug模式
- JS适用于Firefox和Safari,但不适用于Chrome.此处'是我的网站
- Regex不适用于Firefox,但适用于Chrome
- 通过单击主菜单外部关闭子菜单'不适用于IE,但适用于Firefox&铬
- AngularJS$http.post没有'不适用于Chrome,仅适用于IE
- 在OSX Safari(适用于Chrome/Firefox)上,滚动事件期间的CSS定位无响应和抖动