Welcome, Guest
Username: Password: Remember me

TOPIC: Auto check for existing jQuery

Auto check for existing jQuery 20 Jan 2013 13:04 #6485

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Dear Cooks and head chef,

I think its quite important to load only assets that aren't already loaded into joomla and therefore, I wonder, could we add j-cook.pro/forum/35-jquery/6484-avoid-co...y-only-if-not-loaded this into components by default?

It's just a short script to check the head before adding the jQuery library to a component.

Anyway, just a suggestion. To achieve this in your existing COOK components, follow the linked post above.

Thanks,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
Last Edit: 20 Jan 2013 13:08 by JoomGuy.
The administrator has disabled public write access.

Re: Auto check for existing jQuery 25 Jan 2013 13:57 #6507

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
I've read it and I do not real answer for that. The code you propose works only if jquery is loaded through an url or file wich contains 'jquery'.


I take note to include a param wich allow or not jquery loading. I think it is the most easy and stable.
Another way is to call it in JS, checking if the jQuery var is defined (once all the scripts have been loaded).
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Auto check for existing jQuery 25 Jan 2013 14:13 #6508

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Yes, good point monsieur!

I guess it's not 100% safe way to check it although, 99.9 percent of JS bundled in components would use 'jquery' in the path/filename.

G
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.
Time to create page: 0.073 seconds

Get Started