Drupal - Including a different jQuery version only on specific page

Here are your options:

  • Use jQuery Multi, as mentioned in another answer. It can be configured to load the higher version of jQuery just on that page and just for the fancy box. It won't interfere with Drupal's jQuery or with jquery_update's jQuery.
  • In Drupal 7, you can use hook_js_alter(), which will let you swap out jquery_update's version with whatever you want.
  • In Drupal 6 with jQuery Update, it provides a hook that lets you alter the JS after it's done doing its thing. You can look at the jQuery Multi 6.x code to see how it uses this hook.
  • In Drupal 6 without jQuery Update, you can do this using a preprocess_page hook. The $scripts variable will be available there, and you can change it. This can get a bit tricky. You can also see how qmulti does this. jQuery Update also does this in a similar way.

Remember that swapping to a higher jQuery version can break some things in Drupal core and contrib, which is the problem jQuery Multi solves. So if you do this make sure you're not breaking anything. The benefit here is that you just load the jQuery you need, while with jQuery Multi you'll load both.


There is a module jQuery multi. This module allows you to have multiple versions of jQuery run parallel on your drupal instance. It provides an alias for each instance which you can use for calling that version of jquery.


If you have troubles with jqueryupdate and views admin pages (for example) try to install Dev version of ctools and everything will be OK, just tested myself.

Tags:

Javascript

6