I like to keep things clean and simple ! So when it comes to jquery and loading external library scripts ( addons / plugins etc ) i focus on techniques that minimize the total 'size' of the webpage . My goal is to keep my site light and robust without overloading it with unnecessary code . So the question is this ! "Can i manage my jquery scripts with drupal 6.x and load them only to pages that is necessary and not all the time ? " The answer of course to a question like this is "Yes you can" and in a very simple way actually ;) . So how do we do this ? Well first of all we're going to use the drupal_add_js function that manages the js extra scripts that we might want to load with drupal . ( Please note that my solution works for drupal 6.x . I've not tested it to other versions of drupal ! But i guess that this is not going to be so difficult ) . What we read from the official drupal page is
The behavior of this function depends on the parameters it is called with. Generally, it handles the addition of JavaScript to the page, either as reference to an existing file or as inline code. The following actions can be performed using this function:
* Add a file ('core', 'module' and 'theme'): Adds a reference to a JavaScript file to the page. JavaScript files are placed in a certain order, from 'core' first, to 'module' and finally 'theme' so that files, that are added later, can override previously added files with ease.