Front-end tuning: downloading javascript files in paralell

redox's picture

I was looking for frontend tuning for faster page load. I found some very good technics, almost all already improved by drupal, but I can't figure out how to load javascripts in the button of the page. As you can see Javascript is loaded on the top of each page, while that happens page loading is blocked to other things like loading images,flash and also cause a gap while processing that code and restart loading the rest of the page...

I think these urls are good guides for improving front-end performance:
http://code.google.com/intl/en/speed/page-speed/docs/rules_intro.html
http://sites.google.com/site/io/even-faster-web-sites

Is there someone that know how to load drupal javascripts in the button?

thanks

AttachmentSize
externaljs1.png75.51 KB
waterfall1.png6.58 KB
waterfall2.png5.92 KB
Login to post comments

see http://api.drupal.org/api

dalin's picture
dalin - Thu, 2009-09-10 08:49

see
http://api.drupal.org/api/function/drupal_add_js/6

for scope set it to 'footer'

--
Dave Hansen-Lange
Web Developer
Advomatic LLC
East Asia Office
Hong Kong


That will help, I will post

redox's picture
redox - Thu, 2009-09-10 17:44

That will help, I will post something when it's done.

Thanks

God bless Drupal


You can also do a quick edit

intoxination - Thu, 2009-09-10 12:08

You can also do a quick edit in your page.tpl.php file and move

<?php
print $scripts;
?>
to the bottom the page.


I was not really clear on my

redox's picture
redox - Thu, 2009-09-10 17:59

I was not really clear on my post, but it's not only about putting scripts on the button, it's about change the way drupal call it or change the javascript tag. A simple change could be adding a defer="defer" on javascript tag. It could solve that for IEs and new FF3.5, but only putting the scripts on the button not really avoid javacript blocking page load.

Thanks

God bless Drupal


Parallel Module

mikeytown2's picture
mikeytown2 - Thu, 2009-09-10 22:13

http://drupal.org/project/parallel
It splits images css and js into their own domains. if using javascript optimization, then this won't do much since it only downloads 1 file... I made a post that has some ideas for lazing loading: http://drupal.org/node/543510


CSS Gzip

Onopoc's picture
Onopoc - Fri, 2009-10-23 09:29

Another module that might help http://drupal.org/project/css_gzip