Put scripts at the bottom of the HTML body


Page loading

In most cases it is better to put the Javascript script at the very most bottom of the HTML document. It is possible inside the HTML body element.
There are only a few minor reasons against this bottom placement.


  • Do not disturb the HTML load content with script loadings.
  • Javascript need the first full loaded HTML content to interact with the UI.
  • No time spend for validation scripts to ensure the HTML load events are raised.
  • Even for catch raised events, it is a saver coding in cross browsers.


  • The readability for the HTML document will be deteriorate oneself, e.g. for long documents.
  • Very slow script loadings will irritate the user, e.g. no javascript interaction is possible with the loaded HTML content, till the script is loaded.

Example: Javascript placed at the HTML body bottom.

        // content
        <script type="text/javascript" src="js/script.js"></script>

Further links at that this topic

Yahoo! Developer Network. Best practices for speeding up your web site.

© Kometschuh.de | Impressum | GitHub | Facebook |