调用GBrowserIsCompatible()时Google Maps API JavaScript错误 [英] Google Maps API JavaScript error when GBrowserIsCompatible() is called

查看:230
本文介绍了调用GBrowserIsCompatible()时Google Maps API JavaScript错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  if(GBrowserIsCompatible()){

这是我的代码仍然不起作用

 < script src =http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=<?php echo $ google_api ['VALUE']; ?>中类型= 文本/ JavaScript的 >< /脚本> 

< script type =text / javascript>
var map = null;
var geocoder = null;

函数初始化(地址){
if(GBrowserIsCompatible()){
map = new GMap2(document.getElementById(map_canvas));
map.setCenter(new GLatLng(37.4419,-122.1419),13);
geocoder = new GClientGeocoder();
$ b $ *开始* /

(geocoder){
geocoder.getLatLng(
地址,
函数(点){
if(!point){
alert(address +not found);
} else {
map.setCenter(point,13);
var marker =新的GMarker(点);
map.addOverlay(marker);
marker.openInfoWindowHtml(address);
}
}
);
}

/ *结束* /
}
}
< / script>


解决方案

该页面是使用https协议(而不是http)查看的。你是通过https还是http使用它?无论如何,除非您向Google支付10000美元的费用,否则将会有警告。


I get an error on the following line:

 if (GBrowserIsCompatible()) {

this is my code still not working

<script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=<?php echo $google_api['VALUE'];?>" type="text/javascript"></script>

<script type="text/javascript">
var map = null;
var geocoder = null;

function initialize(address) {
    if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        geocoder = new GClientGeocoder();

        /* Start */

        if (geocoder) {
            geocoder.getLatLng(
                address,
                function (point) {
                    if (!point) {
                        alert(address + " not found");
                    } else {
                        map.setCenter(point, 13);
                        var marker = new GMarker(point);
                        map.addOverlay(marker);
                        marker.openInfoWindowHtml(address);
                    }
                }
            );
        }

        /* End */
    }
}
</script>

解决方案

I've had the same problem with internet explorer if the page was viewed with https protocol (instead of http). Are you using it via https or http? Anyway with https there will be warnings unless you pay something like 10 000$ to google.

这篇关于调用GBrowserIsCompatible()时Google Maps API JavaScript错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆