2016-08-16 43 views
-1

錯誤有一個與我的谷歌問題映射here谷歌地圖在某些設備上可見,對他人

這是我的電腦上看到,也與其他瀏覽器,並在一個私人會議和其他設備。 不幸的是,我的客戶,網站的所有者和一些其他設備不可見。 控制檯說

Google Maps API warning: NoApiKeys

You have included the Google Maps API multiple times on this page. This may cause unexpected errors.

這是我有:

<div id="map" style="width:100%; height:450px;"></div> 
        <script> 
        function initMap() { 
         var myLatLng = {lat: 50.8394968, lng: 4.2694918}; 

         var map = new google.maps.Map(document.getElementById('map'), { 
          zoom: 16, 
          center: myLatLng 
         }); 

         var marker = new google.maps.Marker({ 
          position: myLatLng, 
          map: map, 
          title: 'Hello World!' 
         }); 
         marker.setMap(map); 

         var infowindow = new google.maps.InfoWindow({ 
          content:"<p style='text-align:center;'>Wellness All-In <br>"+ 
          "Broekstraat 56 – 1700 Dilbeek<br>"+ 
          "0496/44.55.56<br>"+ 
          "[email protected]</p>" 
         }); 

         google.maps.event.addListener(marker, 'click', function() { 
          infowindow.open(map,marker); 
         }); 
        } 
        </script> 
        <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA5RLhWKFn4P2XVc8G_yho1oun7xS1RtfU&callback=initMap"></script> 

       </div> 

有誰知道如何解決這一問題?

回答

1

您已包含Google地圖兩次。一旦與關鍵

<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA5RLhWKFn4P2XVc8G_yho1oun7xS1RtfU&callback=initMap"></script> 

,一次不

<script src="http://maps.googleapis.com/maps/api/js"></script> 

刪除第二個包含語句。

你的網站還顯示了以下錯誤:

Google Maps API error: RefererNotAllowedMapError https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error Your site URL to be authorized: http://www.wellnessallin.be/contact.php

確保你的網站添加到在谷歌API控制檯允許引薦指定鍵列表。

+0

這樣做,非常感謝! –

相關問題