Search code examples
jqueryjoomlajoomla2.5

Joomla! Load jQuery library locally (without internet connection)


I have a Joomla! template which uses jQuery. When working on my local machine connected to the Internet, the website works fine.

Without Internet, the page displays a blank page with a process bar in the center of the page.

Where is jQuery included in my template? How can I load it locally?


Solution

  • This is the code we use to ensure only 1 copy of jQuery is imported, and if it isn't, it should be loaded from a specific location:

    <?php
      // load jQuery, if not loaded before
      if(!JFactory::getApplication()->get('jquery')){
         JFactory::getApplication()->set('jquery',true);
         $doc = JFactory::getDocument();
         $doc->addScript(JUru::root() . 'templates/TEMPLATE_NAME/js/jquery.js');
      }
    ?>
    

    Hope this helps