Answer the question
In order to leave comments, you need to log in
How to disable script loading for mobile devices?
I want to disable the loading of the Yandex.maps script on mobile devices, because the map does not appear on them. I tried to write in the HTML file like this:
<script type="text/javascript">
if (document.body.clientWidth > 640) {
document.write ('<script src="https://api-maps.yandex.ru/2.1/?apikey=[тут мой API key]&lang=ru_RU" type="text/javascript"></sc' + 'ript>');
}
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question