Hello,
I have a google maps API but the map isn’t loading, if I enter the page with the navigation.
I have to refresh the page once, before the map is loading.
I think the callback doesn’t get executed, when entering the page with the navigation.
I added a postMessage function, when I enter the page with the navigation I get no message. When I refresh the page once I get the message “yes”.
Is this actually a map error, or is this error caused by Wix?
<html>
<head>
<title>Simple Map</title>
<style type="text/css">
#map {
height: 100%;
}
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
</head>
<body>
<div id="map"></div>
<script>
function initMap() {
window.parent.postMessage({
"type": "yes"
}, "*");
const myLatLng = {
lat: -25.363,
lng: 131.044
};
const map = new google.maps.Map(document.getElementById("map"), {
zoom: 4,
center: myLatLng,
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap&libraries=&v=weekly" async></script>
</body>
</html>