This is one of many questions or queries that I have about the implementation of Google Maps in a web page. The first one is that by entering the following line with my APIKEY the map IS NOT SHOWN:
<script src="https://maps.googleapis.com/maps/api/js?key=BLABLABLABLABLABLABLABLABLABLABLA&callback=initMap" async defer></script>
On the other hand, if I add this other line before, if it is shown !!!
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
Seeing with F12 it tells me that I have included the google maps api many times... The code that I have armed is the following:
<head>
<meta charset="utf-8">
<title>Mapa</title>
<style>
#map-canvas {
height: 800px;
width: 100%;
box-shadow: 5px 5px 5px #888;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<!--<script src="https://maps.googleapis.com/maps/api/js?key=BLABLABLABLABLABLABLABLABLABLABLA&callback=initMap" async defer></script>-->
@MNibor the js?sensor=false" reference is no longer needed in the latest version of Google Maps.
https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required
Practically when you place the two scripts you are duplicating the same reference.
Here is a basic example of a map. https://jsfiddle.net/api/post/library/pure/