我正在尝试使用 google.loader.ClientLocation 和 maps api 来获取访问者的位置并将地图居中。以下对我来说工作正常(在 Safari、Firefox 和 Chrome 上),但我测试它的朋友(在 Safari 和 Firefox 上)只看到一个带有 Google 徽标的白框。
<script type="text/javascript" src="http://www.google.com/jsapi?key=MykeyHere"></script>
<script type="text/javascript">
google.load("maps", "2");
</script>
<script type="text/javascript">
function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("local_map"));
map.setMapType(G_PHYSICAL_MAP);
map.setCenter(new GLatLng(google.loader.ClientLocation.latitude, google.loader.ClientLocation.longitude), 15);
// map.setCenter(new GLatLng(54.5975, -5.920278), 15);
map.setUIToDefault();
}
</script>
有什么想法可能会出错吗?该网站位于http://www.chris-armstrong.com/ticktalk(地图靠近底部)