Posted by Woggers on May 18, 2010 at 6:35pm
8 followers
Jump to:
| Project: | jQuery Update |
| Version: | 6.x-2.0-alpha1 |
| Component: | User interface |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (works as designed) |
Issue Summary
jquery is not being dumped for anonymous users. When logged in as an administrator though, jquery does indeed get loaded and works fine.
When viewing site as anonymous though - jquery (and $scripts) never get rendered on any template pages?
Anyone know whats going on?
Comments
#1
I should add that this Drupal deployment is running on v6.6 which goes back to 2008. Client refuses to update to latest version. No idea why. I'm concerned this might be a bug w/ 6.6 or earlier ?
#2
I am also having the same problem. Did you find a solution?
#3
jQuery Update works by altering the theme registry and sticking jquery_update_preprocess_page() in as the last hook_preprocess_page() function called. If something else is interfering with this behavior jQuery Update will not work. Is that happening?
This is the only way to effect this change in Drupal 6. Drupal 7 has a new hook we can use to avoid this process.
#4
I had the same problem today, in fact. I had no problems with scripts not loading until I would log out and view the site as an anonymous visitor. In my situation, I did not include any script files in my theme's .info. Keep in mind that Drupal 6.x by default includes scripts[] = script.js unless you override it in your .info file. I created an empty script.js file in my theme's directory and this seems to have solved the problem. jQuery and drupal.js both loaded fine after this change. This behavior seems a little odd to me, but it was easy enough to fix.
#5
Creating a empty script.js in my theme's directory worked for me as well!
#6
Scripts are only added to a page if they are needed. If nothing calls drupal_add_js() the scripts will not be added. This includes jquery.js and drupal.js. The the scripts only being added for authenticated users by the code?
There really is not enough detail to diagnose what's going on here.
#7
Ok I had the same issue, here is the entirety of my problem:
I'm running jQuery in a block in order to use per-page visibility settings that blocks provide.
This code generates errors if I am not logged in as $scripts is not being loaded for anonymous users, which includes jQuery provided by the jQuery Update module.
If I add a blank js file to my theme.info file, then $scripts outputs for anonymous users, and also includes jQuery allowing my jQuery in a block to run without error.
I'm guessing that jQuery is only running as admin_menu is requiring it, which only runs when a user is logged in.
In my opinion, either jQuery Update needs to run jQuery for anonymous users regardless of other modules, or provide this control in the options.
Thanks for the above people who found the fix :)
#8
Nope, it would be wrong to load JavaScript for pages that don't need it. If you need jQuery, then you have to properly load it.
#9
I simply granted admin theme permission to anonymous and it solved this problem.
jQuery update didn't work with admin nor anon and therefore I've added latest jQuery and UI from theme using alter().
This way I can use theme roller and be able to provide eye-candy for every user. :)