Hey,
since some weeks I got a new warning on my website:
I have a Google Maps iFrame on my site and sometimes it doesn’t load. Can this be the reason for this?
I’m using an onRedy function in the iFrame, to send there some data, after the site is loaded:
<body onload="ready()">
<div id="map" style="height: 100%; width: auto" />
<script type="text/javascript">
.....
function ready() {
window.parent.postMessage({"type":"ready"}, "*");
}
Sitecode:
$w.onReady(function () {
$w("#htmlMap").onMessage((event) => {
if (event.data.type === 'ready') {
let markers = [];
return wixData.query("GoogleMaps")
.find()
.then((results) => {
markers = results.items[0].googleMapArray;
$w('#htmlMap').postMessage({ markers });
});
}
});
});
Is there anything wrong in my code?
Thanks for you help.