Put Scripts at the Bottom
Originally published on the HE:Labs blog.
While a script is downloading the browser won’t start any other downloads, even on different hostnames. Have you ever noticed in some websites where the page seems to be loaded but the screen continues white for some time while it stills loading something more?
This does not happen when all scripts are placed at the bottom. It is a best practice in order to speed up your website: Put Scripts at the Bottom.
In some situations it isn’t easy to move scripts to the bottom. It’s also a best practice to not have inline JavaScript in your pages. But it may have some inside a specific page and it may need a variable or a framework to work correctly.
One more thing
Loading secondary content after page style and script will help a lot your page seems to load faster. For external widgets, for example Facebook Like Box you can do:
For images you can use the Lazyload, the standalone JavaScript lazy loader or the jQuery Lazyload plugin.
Thank you for your attention and for making a faster Internet.