Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

CB & template loading conflicting jQuery versions

  • justmebg
  • justmebg
  • OFFLINE
  • Posts: 23
  • Thanks: 1
  • Karma: 1
13 years 8 months ago #159242 by justmebg
I have been having several issues with my site, including the "attach file" function in Kunena forums not working. People smarter than me from Kunena said this is due to conflicting jQuery libraries being loaded.

Reference article sent by Kunena
My website

Here's what was loading on my site:
module/cb_suggest - jQuery JavaScript Library v1.3.2 (now disabled, developer contacted)
Impacto Template (Joomlashack) - jQuery JavaScript Library v1.4.3
Community Builder - jQuery JavaScript Library v1.5

I contacted Joomlashack support, and here is their answer:

The problem is that CB is loading two different versions itself, which is odd. You need to disable them both, as the one in the template is the best one to keep I think (so it loads on every page properly, whereas CB would only load on pages where CB is used). Please contact CB about this, since the template functions fine when there are multiple copies of jQuery. I tested by disabling the other copies, and the errors went away.


Attached are the Firebug errors and the page source for my site on the lines that are creating the error.

Please advise - what can I do to resolve this issue? I need the attach file function to work, and so far all the support teams have passed the buck. :-)

Beth G
Attachments:

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
13 years 8 months ago - 13 years 8 months ago #159310 by krileon
CB is not loading 2 different jQuery versions. CB does not have 2 different versions. You've a module not developed by us loading a jQuery library then you've a template not developer by us loading a jQuery library. CBs being the latest of all 3 of the loaded libraries. CB also runs in noConflict mode, we can't account for other developers usage of jQuery.

The template and module should be checking the head for an existing library before loading. CB will always push its more up to date library to ensure CBs functionality. An extremely simple JS check to test head and include jquery can be done as follows, this should be employed by your module (if module is CB related it should be using CB API) and template developers to dynamically load jQuery only when missing.
Code:
if ( typeof jQuery == 'undefined' ) { var head = document.getElementsByTagName( 'head' )[0]; var script = document.createElement( 'script' ); script.type = 'text/javascript'; script.src = 'js/jquery.js'; head.appendChild( script ); }

There are some PHP solutions as well as solutions using Joomla API, but the above is likely the easiest and most lightweight of the choices.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 13 years 8 months ago by krileon.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum