JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;sensor=false"></script>
<body>
<div class="map" id="print_advertising"></div>
<script>
initializeGoogleMaps();
</script>
</body>
CSS
.map{
border: 1px red;
height:400px;
width:800px;
}
#coordinates{
height:30px;
width:100px;
color:red;
}
JavaScript
var contentString = "You can add thi zone : <a href=\"#\" onclick=\"alert('Your zone has been added !')\">add</a>";
var infowindow = new google.maps.InfoWindow({
content: contentString
});
function initializeGoogleMaps() {
var polygonCenter = new google.maps.LatLng( -74.43013763427734,45.95257568359375),
placeholder = document.getElementById("print_advertising"),
mapOptions = {
center: polygonCenter,
mapTypeControl:false,
mapTypeId: google.maps.MapTypeId.ROADMAP
},
map = new google.maps.Map( placeholder, mapOptions ),
kmlLayer = new google.maps.KmlLayer({
url: "http://www.justinweb.pro/compass/910413303.kml"
});
google.maps.event.addListener(kmlLayer, 'click', function(evt) {
infowindow.setPosition(evt.latLng)
infowindow.open(map);
});
kmlLayer.setMap(map);
}