Put scripts at the bottom of the HTML body

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.

Pros

Cons

Example: Javascript placed at the HTML body bottom.


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

Further links at that this topic

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

Recent Posts:

2012
August
EBA-Image-Gallery
Google Chart Tools with JSON
2011
December
PrefetchJS Demopage
November
PrefetchJS
October
Deep linking for the masses
September
Search results for key words
August
Put scripts at the bottom
July
Incorrect meta description
March
Smart Guides
January
Slider with Ajax
Overflow hidden animated

Tags:

© Kometschuh.de | Impressum | Facebook | Google plus