V
V
Vadim Timoshenko2019-04-17 14:59:28
JavaScript
Vadim Timoshenko, 2019-04-17 14:59:28

Error ymaps is not defined on asynchronous loading. How to decide?

To speed up the loading of the site for Google Page Speed, I use the asynchronous loading of the yandex maps API.

<script async="async" src="https://api-maps.yandex.ru/2.1/?lang=ru_RU"></script>

I load the map code inside:
window.addEventListener('DOMContentLoaded', function() {
...
});

Everything works without async. How to be with him? Inside what to load the card code?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Maslov, 2019-04-17
@PbI6A_KuT

Read this and I think if you read carefully, you will not try to load asynchronously.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question