带有Bootstrap的Google地图未显示在fulldomain中

时间:2017-11-15 14:56:11

标签: google-maps bootstrap-4

我的地图显示在我的ISP provider URL中,而不是full domain

我正在使用此脚本显示多制作谷歌地图:

    var locations = [['<b>Base de Operaciones</b><br>Ruta 9 km450<br>Marcos Jurez, Cordoba<br>Tel: 701-555-1234<br>', -32.6836311,-62.1571096, 4], ['<b>Oficina Comercial</b><br>Champagnat 466<br>Marcos Juarez, Cordoba<br>Tel:  (+54) 3472-425-532 interno 32<br>', -32.6944151,-62.1001607, 5]];
   var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 13,
      /* Zoom level of your map */
      center: new google.maps.LatLng(-32.6935284,-62.1391514),
      /* coordinates for the center of your map */
      mapTypeId: google.maps.MapTypeId.ROADMAP
    });

    var infowindow = new google.maps.InfoWindow();

    var marker, i;

    for (i = 0; i < locations.length; i++) {
      marker = new google.maps.Marker({
        position: new google.maps.LatLng(locations[i][1], locations[i][2]),
        map: map
      });

      google.maps.event.addListener(marker, 'click', (function(marker, i) {
        return function() {
          infowindow.setContent(locations[i][0]);
          infowindow.open(map, marker);
        }
      })(marker, i));
    }

这是我的HTML:

<section id="location" class="map">
    <h2><center>Ubicaci&#243n</center></h2>
    <div class="embed-responsive embed-responsive-16by9">
    <div id="map_canvas" class="embed-responsive-item" >
    <div id="map"></div>
    <script src='https://maps.google.com/maps/api/js?sensor=false'></script>
    <script src="./js/index.js"></script>
    </div>
    </div>
    </section>

1 个答案:

答案 0 :(得分:0)

检查js控制台以了解问题所在。使用浏览器检查器并导航到控制台。在您的情况下,它会出现以下错误:

  

Google Maps API错误:MissingKeyMapError   https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error

加载API的脚本元素似乎缺少必需的身份验证参数。

祝你好运!希望这可以帮助你!!