network connections a browser must open to load a page. It is common
practice for Drupal themes to put the
<script> tag in the
section of the page. Unfortunately this has a performance impact, as all
browsers will stop processing the page and start loading and processing
in a page so it is loaded and processed after the content.
Making this change in Drupal is a pretty straight forward process. It is
already possible to do this in Drupal 6 or 7. My
site places the
$scripts variable at the end
<head>er, and some even place
<script>s in the body to allow inline
It is too late to implement this change in Drupal 7, but the transition
can occur now. Documentation can be updated to inform theme developers
that they can place the $script variable at the end of the page, just
above where the $closure variable is placed. The module development
guide can be updated to strongly recommend against relying on the value
‘header’ for the ‘scope’ element of the
$options array for
Drupal 8 the scope element for the
$options array can be dropped.
If theme and module developers adopt this best practice approach for their Drupal 7 releases there should be minimal transition work for this change in the version 8 release cycle.