某些Google地图标记不会显示在Internet Explorer中,但会显示在所有其他浏览器中 [英] Some Google Map Markers not showing up in Internet Explorer but show up in all other browsers

查看:205
本文介绍了某些Google地图标记不会显示在Internet Explorer中,但会显示在所有其他浏览器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我们的网站上有一个Google地图,其中包含使用以下代码引入的标记列表:

I have a Google Map on our site that has a list of markers which are brought in using the following code:

$(".map-overlay-right").click(function () {
    var map = new GMap2(document.getElementById('map-holder'));
    $("#map-holder").fadeOut('slow', function(){                                    
        var gmarkers = [];  
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());

        $.get("http://afid.staging.dante-studios.com/xml-feed-google-maps",{},function(xml) {
            $('marker',xml).each(function(i) {
                html = $(this).text();
                lat = $(this).attr("lat");
                lng = $(this).attr("lng");
                label = $(this).attr("label");
                var point = new GLatLng(lat,lng);
                var marker = createMarker(point,label,html);
                map.addOverlay(marker);
            });
        });

    });
    $("#map-holder").fadeIn('slow');    
    var Asia = new GLatLng(23.684774, 90.087891);
    map.setCenter(Asia, 4); 
});

导入它们的XML文件如下所示:

The XML file that brings them in looks like this:

<?xml version="1.0"?>
<markers> 
    <marker id="1" lat="11.547812" lng="104.915957" label="Foo"> 
        <infowindow> 
            <![CDATA[HTML GOES HERE]]>
        </infowindow> 
    </marker> 
    <marker id="2" lat="11.547812" lng="104.915957" label="Bar"> 
        <infowindow> 
            <![CDATA[HTML GOES HERE]]>
        </infowindow> 
    </marker> 
    <marker id="3" lat="11.547812" lng="104.915957" label="Baz"> 
        <infowindow> 
            <![CDATA[HTML GOES HERE]]>
        </infowindow> 
    </marker>  
</markers>

由于某些原因,并非所有标记都显示在Internet Explorer中。 IE抛出此错误:

For some reason not all the markers show up in Internet Explorer. IE throws this error:

网页错误详细信息

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; OfficeLiveConnector.1.4; OfficeLivePatch.1.3)
Timestamp: Thu, 17 Dec 2009 12:39:16 UTC


Message: Invalid argument.
Line: 143
Char: 18
Code: 0
URI: http://maps.gstatic.com/intl/en_ALL/mapfiles/193c/maps2.api/main.js

但其余的浏览器似乎是确定和行为良好。抛出错误的代码部分是:

But the rest of the browsers seem to be ok and behaving well. The part of the code that throws the error is this bit:

map.addOverlay(marker);

网站可以在这里看到: http://afid.staging.dante-studios.com/ 并点击亚洲将最好显示错误作为标记在印度底部显示在所有浏览器,但不是在IE。

The site can be seen here: http://afid.staging.dante-studios.com/ and clicking on Asia will best show the error as the markers at the bottom of india show up on all browsers but not in IE.

我花了一段时间试图解决这个问题,但我没有得到任何地方。

I've spent a while trying to resolve this but i'm not getting anywhere. If anyone can shed some light on this i would highly appreciate it.

推荐答案

标记42在您的标记中 XML 的格式错误:

Marker 42 in your marker XML has a malformed latitude:

<marker id="42" lat="-12.968270," lng="28.633699" label="Ndola, Zambia">

请注意 lat 属性中的尾随逗号。

Note the trailing comma in the lat attribute.

这篇关于某些Google地图标记不会显示在Internet Explorer中,但会显示在所有其他浏览器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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