2

I found this code from this topic: Disable script loading in head

$doc = JFactory::getDocument();
$dontInclude = array(
'/media/jui/js/jquery.js',
);

foreach($doc->_scripts as $key => $script){
    if(in_array($key, $dontInclude)){
        unset($doc->_scripts[$key]);
    }
}

However, my site's module loads it with the domain first.

<script src="https://www.DOMAIN.com/modules/mod_jux_background_video/assets/js/jquery-ui.min.js" type="text/javascript"></script>

How do I edit the array to disable this module's jquery?

0

1 Answer 1

0

Since in your case jQuery library is loaded by the JUX background video module thus you can turn jQuery loading off in the admin settings of your module in module manager. So, find your JUX background video module, click on Advanced options -> Enable jQuery, set it to no (if jQuery library is already loaded on your page). You can also set it to noConflict mode as you can see it below.

enter image description here

Edit: Answering your original question programmatically.

From the comments below with additional shared data to the original question it has become obvious the jQuery libraries do not cause any conflict on the particular webpage as apparently there is no conflicting libraries loaded on the page, therefor nothing should be unset in the head of the page, but just for completion of this question I place the code answer here too, maybe someone will need that later:

Since you tried to unset the jQuery UI library in the index.php file of your template, I just place here one line which can unset the library in the document head (unsetting script links in index.php file directly is not recommended at all in Joomla because at the next update of the template it is going to be deleted from the file).

// on the top of the file:
use \Joomla\CMS\Uri\Uri;

// right after the line: <jdoc:include type="head" /> :
unset($this->_scripts[Uri::root() . '/modules/mod_jux_background_video/assets/js/jquery-ui.min.js’]);

The Joomla standard way would be including this kind of codes in a system plugin, like here in this answer: How can I completely remove Bootstrap from the frontend of Joomla?

or in one of my earlier answers on the subject I also included a sample code for this kind of plugin: Modification of the generated Joomla head (<jdoc:include type="head" />)

But as it has gotten clear the whole problem of the original question is totally different and unsetting the jQuery UI library just can cause more problems, and I'll maybe write a short update on that too later...

3
  • Comments are not for extended discussion; this conversation has been moved to chat. Jun 11, 2021 at 3:26
  • Thank you for confirming that it is not a jquery conflict. As for the unset code, I had pasted that into the custom code section in my template(helix ultimate). I have removed it now. Jun 11, 2021 at 16:37
  • It appears that the issue is with the iframe code I tried to use to not show the black frame between loops. dropbox.com/s/gb57pyir5jn1cxc/custom-module-code?dl=0 Jun 11, 2021 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.