How do I disable the loading of

  • mootools-core.js
  • core.js

In <head> without using a third party component/plugin?

  • What version of Joomla are you using? – TryHarder Apr 23 '14 at 0:11
  • @moomoochoo I am using joomla 3.2 – web-tiki Apr 23 '14 at 0:14

Im using Joomla 3.2, at the top of my tempate I put:

$doc = JFactory::getDocument();

$dontInclude = array(

foreach($doc->_scripts as $key => $script){
    if(in_array($key, $dontInclude)){

This prevents those scripts from being included, add or remove scripts as needed

| improve this answer | |
  • 3
    This failed on my last project (joomla 3.3.6). I added JURI::root(true). before the script paths and it worked. – web-tiki Oct 28 '14 at 16:06

You can unset it in the template


This will remove the both JS files from the Header.

| improve this answer | |

In Joomla 3.x, you can call JHtml::_('jquery.framework') in your template to load jQuery without Mootools. This loads jQuery in no conflict mode by default so if you need normal mode, just add a second parameter of false: JHtml::_('jquery.framework', false).


| improve this answer | |

I've used this:

foreach ($doc->_scripts as $script => $value)
    if (preg_match('/media\/jui/i', $script))
| improve this answer | |
  • 2
    Since your needle string is not variable and the only intention is to make a case-insensitive match, then it would be better practice to use stripos() ... if (stripos($script, 'media/jui') !== false) – mickmackusa Nov 30 '18 at 0:40

The solution by @ContextSwitch wasnt working for me due to some scripts were being loaded after the template was processed so unsetting the files at that stage had no effect on those files.

So I had to implement the similar solution but using a simple plugin bound to onBeforeCompileHead event. As described by me here.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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