【发布时间】:2012-09-20 05:41:45
【问题描述】:
我正在使用 google API 来检测客户端位置,但它总是向我显示“Google Loader 未检测到您的位置”。
我需要找到客户所在地的国家/地区代码,但它不适合我。
<script src="http://www.google.com/jsapi" language="javascript"></script>
<script language="javascript">
if (google.loader.ClientLocation != null) {
document.write("Your Location Is: " + google.loader.ClientLocation.address.country_code);
} else {
document.write("Your Location Was Not Detected By Google Loader");
}
</script>
【问题讨论】:
-
你在传递google.com/jsapi?key = 什么吗?
-
@Sheeraz,正如 GBD 提到的,您需要传递 key 。对于地理位置,您需要通过google.com/jsapi?key=YOURAPIKEY
标签: javascript api