javascript - Why are JS scripts usually place in the header of a document? -


Why do JS scripts usually put in the header of a document? Is it necessary for standards or is there any special reason?

This is just a conference. It is usually recommended to insert the script at the end of the body so that the pages can display them before loading, which is always a plus. In addition, document.body should not be used until then. Until the document is loaded or if you put the script in the body.


Comments

Popular posts from this blog

ios - Form Sheet content disappearing -

MySql variables and php -

php - Laravel - Overriding a resource route into a different route filter group -