Any way to implement feature which will load different jQuery version on specified pages?
I.e. this page: http://demos.openspending.org/openspendingjs/app/spend-browser/
doesn't work under IE6 with jQuery v1.3.2, but works with v1.5.2
Currently I've hack:
Index: trunk/public_html/sites/all/modules/jquery_update/jquery_update.module
===================================================================
--- a/trunk/public_html/sites/all/modules/jquery_update/jquery_update.module
+++ b/trunk/public_html/sites/all/modules/jquery_update/jquery_update.module
@@ -166,4 +166,11 @@
function jquery_update_jquery_path() {
$jquery_file = array('none' => 'jquery.js', 'min' => 'jquery.min.js');
+
+ // HACK to load jquery 1.5.2 ONLY on the openspending page
+ // END: HACK
+ if ($_SERVER['REQUEST_URI'] == '/openspending') {
+ $jquery_file = array('none' => 'jquery.js', 'min' => 'jquery.min.1.5.2.js');
+ }
+
return JQUERY_UPDATE_REPLACE_PATH .'/'. $jquery_file[variable_get('jquery_update_compression_type', 'min')];
}
See jQuery bug: http://bugs.jquery.com/ticket/6498
And discussion: http://forum.jquery.com/topic/object-doesn-t-support-this-property-or-me...
Comments
Comment #1
kenorb commentedRelated:
#426764: Allow other modules to alter the replacements
#1067290: Fix jQuery 1.7 for Drupal 6
Comment #2
kenorb commentedWorkaround at beginning of the .module file:
Unfortunately I can't override the path, because it's hardcoded as constant. So I have to load this code before jquery_update loads.
Maybe we should use variable instead of constant?
Comment #3
blainelang commentedThanks for the hack idea as this worked for me. Panels 6.3 IPE did not work with an updated version of jQuery (works fine with the default 1.3.2 version) and yet I needed version 1.4.4+ for another site feature.
It would be nice to be able to include/exclude site paths to to be used for the update/replace similar to how the wysiwyg editors and other modules work.
Comment #4
sgriffin commented[code]
function jquery_update_jquery_path() {
if (arg(0) != 'admin' && arg(1) != 'add' && arg(2) != 'edit') {
$jquery_file = array('none' => 'jquery.js', 'min' => 'jquery-1.6.2.min.js');
// $jquery_file = array('none' => 'jquery.js', 'min' => 'jquery.min.js');
}
else {
$jquery_file = array('none' => 'jquery.js', 'min' => 'jquery.min.js');
}
return JQUERY_UPDATE_REPLACE_PATH .'/'. $jquery_file[variable_get('jquery_update_compression_type', 'min')];
}
[/code]
etc works pretty well too.
There are few things besides the admin area that require old jq.
The only problem found so far is was a minor one with lightbox.
Comment #5
jthomasbailey commented#4 messes up Panels' ajax when you try to add/edit panel panes so I added a line:
Might be a better way to do it but it works.
Comment #6
sgriffin commentedI think it would be great to support non drupal versions directly in the module. The current d6 jquery version is WAY out of date. There are just a few exceptions where drupal jquery is vital except for administration.
Comment #7
jthomasbailey commentedSorry, the last one was no good, this works though:
Line 61 of jquery_update.module:
Comment #8
jthomasbailey commentedUpdate, gotta add a 'ctools' exception:
Comment #9
XerraX commentedYou saved my day. Thanks
Comment #10
sgriffin commentedanother exception for arg(0) == 'batch'
Comment #11
hansrossel commentedRelated: some other methods to load newer versions of jquery: http://drupal.org/node/1058168
Comment #12
drupalmoff commentedTo get it working I had to do the following (Drupal 7):
Comment #13
ak55 commentedThank you drupalmoff for the snippet.
It works perfectly.
Comment #14
markhalliwellDrupal 6 reached EOL (end-of-life) on February 24, 2016.