Move All JavaScript to the Page Footer

Part of Yahoo!'s YSlow recommendations is to load JavaScript in the footer of the page. Drupal's theming system usually has two variables, $scripts (in the ) and $closure (before the closing tag). According to Wim Leers, the quicket way to move all Drupal's JS to the footer is by moving $scripts just before $closure.

Why is this useful? Because whatever comes after the JS must wait for the JS to load. That's why it makes sense to put JS at the bottom.


  • Faster page load experience for end-users