Category: Development
Drupal – Use a different jQuery version for the frontend and backend
Author(s)
The module jQuery Update take care of updating jQuery to a newer version. I even use the dev version so I can have jQuery 1.8. Sadly this creates some bugs in the admin. To avoid conflict I decided to load a different jQuery version for the backend and the frontend.
To do that you have to create a very small module with this code:
/** * Implements hook_module_implements_alter(). */ function mymodule_module_implements_alter(&$implementations, $hook) { if ($hook == 'library_alter') { if(isset($implementations['jquery_update'])) { // Move jquery update to the end. This will make sure our hook_library_alter // is always called before the jquery_update. $jquery_update = $implementations['jquery_update']; unset($implementations['jquery_update']); $implementations['jquery_update'] = $jquery_update; } } }/** * Implements hook_library_alter(). */ function mymodule_library_alter(&$libraries, $module) { // If it is the admin theme all we want to do is change the global $conf // variable so when jquery_update runs right after us it will use 1.5. // We are not using path_is_admin(current_path()) because some admin path can use // the frontend theme like node edit page global $theme_key; if (variable_get('admin_theme') == $theme_key) { // Modifying global $conf variable, can be dangerous. Be carefull. global $conf; $conf['jquery_update_jquery_version'] = '1.5'; } } I also write some patches to try to solve the compatibility problem in jQuery and in core but I prefer to stay safe for now until it’s fixed. If you want to know more about the issue check out http://drupal.org/node/1498858.
The module jQuery Update take care of updating jQuery to a newer version. I even use the dev version so I can have jQuery 1.8. Sadly this creates some bugs in the admin. To avoid conflict I decided to load a different jQuery version for the backend and the frontend.
To do that you have to create a very small module with this code:
/** * Implements hook_module_implements_alter(). */ function mymodule_module_implements_alter(&$implementations, $hook) { if ($hook == 'library_alter') { if(isset($implementations['jquery_update'])) { // Move jquery update to the end. This will make sure our hook_library_alter // is always called before the jquery_update. $jquery_update = $implementations['jquery_update']; unset($implementations['jquery_update']); $implementations['jquery_update'] = $jquery_update; } } }/** * Implements hook_library_alter(). */ function mymodule_library_alter(&$libraries, $module) { // If it is the admin theme all we want to do is change the global $conf // variable so when jquery_update runs right after us it will use 1.5. // We are not using path_is_admin(current_path()) because some admin path can use // the frontend theme like node edit page global $theme_key; if (variable_get('admin_theme') == $theme_key) { // Modifying global $conf variable, can be dangerous. Be carefull. global $conf; $conf['jquery_update_jquery_version'] = '1.5'; } }I also write some patches to try to solve the compatibility problem in jQuery and in core but I prefer to stay safe for now until it’s fixed. If you want to know more about the issue check out http://drupal.org/node/1498858.
More articles
Author(s)
Smashing Conference Freiburg 2026
Back in Freiburg for Smashing Conference 2026: AI and design systems, deeply technical CSS and HTML, and more human talks about teams and mindset. Here's what we took away.
Author(s)
Making of : “La nuit des Losers”
lanuitdeslosers.ch, built fast: paper wireframes, a bold hand-drawn identity, then Claude Code to prototype and ship. A mouse-tracking hero animation, a bowling game made of sponsor logos, and a few bugs we’re keeping.
Author(s)
Dark mode: necessity or trend
Nous faisons le tri entre idées reçues, réalités techniques et bonnes pratiques de design.












