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

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -