[development] Where should we call drupal_add_js?

Wim Leers bashratthesneaky at gmail.com
Mon May 21 13:59:01 UTC 2007

Option #3 is the best one, if the situation permits it.


On May 21, 2007, at 10:33 , Fernando Silva wrote:

> Hi everyone,
> Assuming that we want to reduce the size of JavaScript transfered to
> the client we have some options:
> * always call drupal_add_js() in hook_menu() because it will be
> download only once to the entire site?
> * is there other place where we can call drupal_add_js() in a global
> way? hook_init() probably not because it does not get executed with
> "aggressive cache" I think...
> * only call drupal_add_js() when we are going to use some of it, in
> the current page?
> Regards,
>  Fernando Silva

More information about the development mailing list