Where is the ideal place to load javascripts in html?
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you put the script in the
head
tag HTML page rendering is blocked until the script is downloaded. The more scripts you will put there the slower your page will load.That’s why an advanced approach is to put the scripts at the bottom of the BODY, and in this case the user can start interacting with a page before the Javascript has Loaded.
You will put the scripts in
HEAD
only if they MUST be available before the page is shown.