Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

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

  • JoomGuy
  • JoomGuy's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
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!!!

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

Last edit: by JoomGuy.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

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

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

  • JoomGuy
  • JoomGuy's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
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!!!

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

  • Page:
  • 1
Time to create page: 0.060 seconds

Les générateurs de code je les connais presque tous pour les avoir essorés en long en large et en travers ... mais celui ci c'est vraiment un outil formidable de simplicité et d'efficacité !
Marc. (liubov - Forum)

Get Started