1 private link
"One good practice in web performance optimization is to “put script at bottom”.
The reason is that while scripts are loading, most browsers block others components from loading.
When you put your scripts at the bottom of the HTML document, all components can be loaded without delay, and, in the end, scripts can be loaded.
However, doing this way has some drawbacks :
One is that the loading of externals scripts is delayed after all other components. Then, browsers have to execute it and the onload event of the page can also be delayed due to this late loading.
Another major drawback is the presence of inline <script> in the <body>.
Of course, as externals scripts are loaded at the end of the page, any inline script that needs to use it has also to be pushed at the end of the page. This can be quite easy when the HTML page is hand-made.
But in most cases, HTML document scripts are added by several modules provided by a CMS or jQuery plugins. And these modules often have inline javascript in order to initialize behaviors related to the functionality they provide, when the document is ready.
Especially when working with jQuery, if you load it at the bottom, all preceding jQuery('document').ready() calls will fail.
I’ve been wondering for a long time if it would be possible to get rid of these drawbacks while reaching the following goals:
early external jQuery loading
non blocking jQuery loading that allow other components on the same page to be loaded in parallel, including jQuery plugins
non blocking inline script in the HTML document, that could call jQuery('document').ready(), even when jQuery and its plugins havent’ been loaded yet.
jQl is my solution."