谷歌地图不会出现在联系页面上

时间:2016-07-13 13:42:51

标签: google-maps google-maps-api-3

我在我的网站上插入谷歌地图时遇到问题我在下面插入了代码...

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false">
</script> 
<script src='https://maps.googleapis.com/maps/api/js?v=3.exp&key=AIzaSyD0jH85l0hZ_tNF6zl35997Nb6HXLj9YYI'></script>
<div style='overflow:hidden;height:471px;width:100%;'>
<div id='gmap_canvas' style='height:471px;width:100%;'></div>
  <style>#gmap_canvas img{max-width:none!important;background:none!important}</style>
</div> 
<a href='https://embedmaps.net'>www.embedmaps.net</a> 
<script type='text/javascript' src='https://embedmaps.com/google-maps-authorization/script.js?id=370cd4178fedb6711b4163f7e3b23f5bc71df81c'></script>
<script type='text/javascript'>
function init_map(){
  var myOptions = {
    zoom:12,
    center:new google.maps.LatLng(26.169595,91.7563156),
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  map = new google.maps.Map(document.getElementById('gmap_canvas'), myOptions);
  marker = new google.maps.Marker({
    map: map,
    position: new google.maps.LatLng(26.169595,91.7563156)
  });
  infowindow = new google.maps.InfoWindow({
    content:'<strong>NEWS Travel Services (India) </strong><br>Choudhury Bhawan, House No.33,  Borthakur Mill Road, Ulubari<br>781007 Guwahati <br>'});
  google.maps.event.addListener(marker, 'click', function(){
    infowindow.open(map,marker);
  });
  infowindow.open(map,marker);
}
google.maps.event.addDomListener(window, 'load', init_map);
</script>

网站的实时网址为http://www.newstravelservices.com/

1 个答案:

答案 0 :(得分:1)

删除此行:

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false">
</script>

您还要使用以下行加载Maps API:

<script src='https://maps.googleapis.com/maps/api/js?v=3.exp&key=AIzaSyD0jH85l0hZ_tNF6zl35997Nb6HXLj9YYI'></script>

复制它通常会阻止它工作。第二个可能更好,因为它包括你的API密钥。