There is a cross-window iframe, which contains a link to index.php from another server, which, in turn, has a Yandex maps api script (see below). How to make sure that this script chain is fully loaded? I’m trying the following way:
JavaScript
x
7
1
<script>
2
function loaded() {
3
window.parent.postMessage('loaded', '*');
4
}
5
</script>
6
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" type="text/javascript"></script>
7
<script src="https://api-maps.yandex.ru/2.1/?apikey=bla-bla-bla&lang=ru_RU" type="text/javascript" onload="loaded()"></script>
Advertisement
Answer
Subscribe to ymaps.ready()
. https://tech.yandex.com/maps/jsapi/doc/2.1/ref/reference/ready-docpage/
JavaScript
1
2
1
ymaps.ready(() => notify())
2