I noticed that whenever I switch my javascript compression from enabled to disabled, all separate javascript files will load, but not any of this javascript will work in my drupal installation. So none of the javascript that is actually loaded will work.

This worked normally again when I disabled the admin module.

I have no clue what caused this. I have a copy of this website in production and it has the same issue. I also can't remember if I ever enabled the admin module before without js compression, because I know I installed the admin module quite recently.

Any help and tips to debug this problem is higly welcome. I will try to reproduce this issue on another drupal setup as well.




Danny_Joris’s picture

Hmm, I reproduced this in another setup and there it does work.

Also on the setup where the issue occurs, I disabled the jquery update module, cleared caches and ran cron, but still no result.

cgmonroe’s picture

Can you run it in Firefox and look at the Error Console? This might give the specific JS error(s).

Danny_Joris’s picture

Hi cgmonroe,

Tnx for your feedback. I checked and it says: $.cookie is not a function

It refers to line 140 of admin.toolbar.js
var cookie = $.cookie('DrupalAdminToolbar');

pdrake’s picture

I have the same problem. In my case, it is mod_security blocking jquery.cookie.js from loading (see http://drupal.org/node/522646 for another bug where this is happening).

yhahn’s picture

Version:6.x-2.0-beta3» 6.x-2.x-dev
Assigned:Unassigned» yhahn

Oh boy... just the kind of bugs I love : |

sampeckham’s picture

I can confirm this problem too. Been having similar issues with Admin menu not opening and enabling "optimize js files" solved it.

In my case checking Safari error console I find the following:

/sites/all/modules/admin/includes/jquery.cookie.js?5 Failed to load resource: the server responded with a status of 404 (Not Found)
/sites/all/modules/admin/includes/admin.toolbar.js?5:140 TypeError: Result of expression '$.cookie' [undefined] is not a function.

I spent a while back and forth with my host company trying to work this out as it was fine on another server, and he reported the following (doesn't mean a lot to me, but maybe it's of some help debugging!?):

Sat Jun 19 21:06:00 2010] [error] [client] ModSecurity: Access denied with code 406 (phase 2). Pattern match "(?:\\b(?:(?:type\\b\\W*?\\b(?:text\\b\\W*?\\b(?:j(?:ava)?|ecma|vb)|application\\b\\W*?\\bx-(?:java|vb))script|c(?:opyparentfolder|reatetextrange)|get(?:special|parent)folder|iframe\\b.{0,100}?\\bsrc)\\b|on(?:(?:mo(?:use(?:o(?:ver|ut)|down|move|up)|ve)|key(?:press|d ..." at REQUEST_FILENAME. [file "/usr/local/apache/conf/modsec2.user.conf"] [line "117"] [id "959004"] [msg "Cross-site Scripting (XSS) Attack"] [data ".cookie"] [severity "CRITICAL"] [tag "WEB_ATTACK/XSS"] [hostname "www.*MYWEBSITE*.org"] [uri "/sites/all/modules/admin/includes/jquery.cookie.js"] [unique_id "TB0jKE1IzGQAAGy8n4MAAAAV"]
pdrake’s picture

new2.85 KB

I created the attached module as a temporary workaround. It loads the jquery.cookie plugin under a different filename to get around the mod_security restrictions. It also unregisters other jquery.cookie.js scripts to prevent 404 errors.

mcrittenden’s picture

mrfelton’s picture

I don't have modsecurity installed, yet this is affecting me.

FranCarstens’s picture

jqcookie.tar_.gz worked for me.

pdrake’s picture

I have added the jqcookie module as a project: http://drupal.org/project/jqcookie (formerly in a sandbox)

antojose’s picture

This seems to be an issue on Drupal 7 as well.

misc/jquery.cookie.js giving 406, causing 'draggable' reordering of menuitems to fail, in Drupal 7.

apoc1’s picture

Any solution found yet? I have D6.22 and have the following;

When Admin module is installed, it seems it conflicts with everything else with JS; TinyMCE not loading, views accordion not working, and so on. Also, the plus-buttons in the menu don't work if other js is on the page. On pages with no other js, the plus-buttons do work again.

If anyone know how to resolve this...?

ykyuen’s picture

#7 jqcookie.tar_.gz worked for me too.

Thanks pdrake. =)

Josephnewyork’s picture

This is crazy! I developed a site locally via MAMP as usual, and in uploading the site to their web hosting, the only error that occurs is this jquery.cookie.js 404. Even it I go to the files URL itself its 404...

Perhaps this is some server configuration in shared hosting which usually has a ton of restrictions written. It could be some format of blacklisting a cookie hack, whatever that is... I dunno...

Looking into this further, let me know if anyone has any ideas.

tachobernal’s picture

Wow, jqcookie.tar_.gz was excelent for me, it solved all my javascript issues, thanks!

freenovate’s picture

new1.76 KB

Inspired by jqcookie, I created a new module jq_cookie_replace that works for Drupal 7.x.
It uses hook_alter_js.

description = "Replaces references to jquery.cookie.js with /modules/jq_cookie_replace/js/jquery.cukie.js; useful for servers with mod_security rules preventing files with [cookie] in the filename from being rendered correctly."

I haven't tested it when caching is on.

jleblanc’s picture

This doesn't work for Drupal 7 which is what I am on. Any ideas how I can fix this same issue on Drupal 7?

gmgallag’s picture

Version:6.x-2.x-dev» 7.x-2.0-beta3
Assigned:yhahn» Unassigned
Status:Active» Reviewed & tested by the community

jq_cookie_replace-7.x-1.0.zip worked for me in drupal 7. Had been experiencing other jQuery issues (besides menu drag and reorder) up to this point. Thanks freenovate. Also haven't tested with caching on.