Google地图有时无法加载

时间:2016-11-07 15:17:09

标签: javascript google-maps

我在我的网站上使用Maps API创建了一个嵌入式地图。它将在大学加载9/10次,但永远不会在家里装载。有没有办法解决这个问题,以便它总是加载。

以下是它正在使用的脚本:

                    <script>
                function initMap() {
                var pointer = {lat: 53.827369, lng: -1.594245};
                var map = new google.maps.Map(document.getElementById('map'), {
                zoom: 14,
                center: pointer
                });

                var marker = new google.maps.Marker({
                position: pointer,
                map: map,
                title: 'Leeds Beckett University "Headingley Campus"'
                });

                var contentString = '<div id="content">'+
                '<div id="siteNotice">'+
                '<\/div>'+
                '<h1 id="firstHeading" class="firstHeading">Leeds Beckett University<\/h1>'+
                '<div id="bodyContent">'+
                '<p class="maptext">Leeds Beckett University is a public university in Leeds, West Yorkshire, with campuses in the city centre and Headingley. The university’s origins can be traced to 1824, with the foundation of the Leeds Mechanics Institute<\/p>' +
                '<p class="maptext"><b>Postcode:<\/b> LS1 3HE<\/p>'+
                '<\/div>'+
                '<\/div>';

                var infowindow = new google.maps.InfoWindow({
                content: contentString
                });


                marker.addListener('click', function() {
                infowindow.open(map, marker);
                });

                }

                </script>

&#34;地图&#34; div已包含在我的HTML中。

1 个答案:

答案 0 :(得分:1)

您的问题似乎是因为您至少从您提供的代码中调用了ORGANIZER:_D043133 。你能否就这个问题提供更多见解?

initMap