@IsaevDev

Можно ли использовать атрибут defer вместо window.onload?

Читаю на htmlbook
"Атрибут defer откладывает выполнение скрипта до тех пор, пока вся страница не будет загружена полностью."
<script defer>...</script>

Речь идет о загрузке структуры страницы или всего контента вообще?
  • Вопрос задан
  • 251 просмотр
Решения вопроса 1
Daemon23RUS
@Daemon23RUS
На htmlbook статья не совсем корректна. Вот еще некоторое описание.

There are three possible modes that can be selected using these attributes. If the async attribute is present, then the script will be executed asynchronously, as soon as it is available. If the async attribute is not present but the defer attribute is present, then the script is executed when the page has finished parsing. If neither attribute is present, then the script is fetched and executed immediately, before the user agent continues parsing the page.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы