-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enqueuing scripts in header #14
Comments
Scripts loaded in the head are downloaded asynchronously of each other before the page loads, while scripts in the footer are downloaded in sequence after the rest of the page is loaded. The difference is that when you load in the head, your net page load time is faster. The only good time to load scripts in the footer, is when you have a very JavaScript heavy website, and loading in footer makes the page appear noticeably faster. (I would say at least 250ms faster) Otherwise, it makes more sense to load them in the head. In this case, most servers will serve the files up fast enough that you won't be able to tell the difference. P.S. |
Thanks Nicholas! |
No problem, and glad I could help 😃 Also, to extend my note on combining files and then serving them. The amount of the decrease in page load time varies from server-to-server, and is largely dependent on how Apache/PHP is configured to work on the system and where the server is located. For example, on a slower configuration, this may save you 400ms and on a faster and distributed system this may only save you 100ms. |
Hi there,
Just wondering if there is a specific reason that you enqueue all the scripts in the header rather than the footer?
Thanks,
Gary
The text was updated successfully, but these errors were encountered: