I need your help please. I want to integrate a Google Map with javascript-api.
I do not know what I'm doing wrong. Google JavaScript API is enabled. My Domain is confirmed. In key=YOUR_API_KEY, i have entered my API-KEY.
The Google code example below of the "Simple Map" creates a blank page. No error message is displayed console screenshot
It seems like the script is loaded, but the map will not be displayed.
<!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"
async defer></script>
</body>
</html>
View this example page on my site map.html
Maybe someone can help me.
Thank You, Chris
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://grossen.de/map.html. Add that URL (or a wildcard URL that includes it) to the allowed referrers for your key.500pxinstead of100%.<div id="map" style="width:500px; height:200px;"></div>I don´t know why, but it works! - thanks