The JavaScript Libraries module doesn't load any custom libraries on administrative pages (the idea being to not allow administrators to add JavaScript that breaks their own admin experience).
The problem is that this casts too wide a net: content creation pages, user profile editing pages, some 403 pages (if the page that the user tried to access would have been administrative), etc all do not have any custom libraries loaded.
The attached patch makes it so that regular users still get the JavaScript loaded on those pages, but site admins with 'view the administration theme' permission don't. That's not perfect, but at least it solves the basic problem. (It seems much more likely that JavaScript could break when it appears on an admin page displayed in the admin theme, rather than the regular site theme.)
We should perhaps consider removing this restriction entirely, since people who want to prevent JS from loading on admin pages do have some other options (e.g., they could attach it to a block that only appears on non-admin pages). But that might be too disruptive of a change for existing sites. I also thought about (and even wrote an initial patch for) making it a site-wide configuration setting with a UI, but decided that didn't make sense on its own anyway, since the current behavior is pretty unexpected and makes sense to fix directly.
| Comment | File | Size | Author |
|---|---|---|---|
| javascript-libraries-load-on-admin-pages.patch | 1.09 KB | David_Rothstein |
Comments
Comment #1
pwolanin commentedStill seems like you might want this to be a setting that could be tweaked, but this fix is fine for now.
Comment #2
David_Rothstein commentedCommitted: http://drupalcode.org/project/javascript_libraries.git/commit/3f7dea2
Will create a followup issue for making this a setting.
Comment #3
David_Rothstein commentedFollowup issue: #1423388: Allow the loading of JavaScript libraries on admin pages to be configured