[development] Where should we call drupal_add_js?

Fernando Silva fsilva.pt at gmail.com
Mon May 21 08:33:17 UTC 2007


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