Some Google Map Markers not showing up in Internet Explorer but show up in all other browsers

萝らか妹 提交于 2019-12-11 04:21:13

问题


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); 
});

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>

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

Webpage error details

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);

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.


回答1:


Marker 42 in your marker XML has a malformed latitude:

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

Note the trailing comma in the lat attribute.



来源:https://stackoverflow.com/questions/1921528/some-google-map-markers-not-showing-up-in-internet-explorer-but-show-up-in-all-o

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!