How to Disable Mootools in Joomla

Warning: Mootools is a well known (and very stable) JavaScript library that is used to support many client-side activities on Joomla. Disabling it/removing it (or replacing it with another library) might cause a lot of instability on your Joomla website and may render your Joomla website (especially its backend) completely inoperable. Please proceed carefully and, needless to say, at your own risk!

Some of our clients with advanced technical skills (who sub-contract to us) sometimes ask us to disable mootools on a Joomla website. We respond that it can be done, but at their own risk, since a lot of Joomla behavior (especially in the backend) is powered by mootools. So they tell us that they want to proceed anyway… Now the question is, how do we do it?

Well, there are several methods to do disable mootools on a Joomla website:

Method #1: Delete the mootools files

This method simply consists of deleting (through FTP) the mootools files that are included by Joomla. The mootools files to be deleted are the following:

  • The mootools-core.js JavaScript file which is located under the /media/system/js directory.
  • The core.js JavaScript file which is also located under the media/system/js directory.

The main advantages of this method is that it’s super fast, but on the flip side, you will be deleting a core Joomla file that you may need later!

Method #2: Comment out the inclusion of mootools in Joomla’s core

As mentioned earlier, the mootools JavaScript library is included in the file behavior.php which is located under the /libraries/joomla/html/html directory. So, to comment out the inclusion of mootools, all you need to do is to comment out the following lines (lines 60-61) in the aforementioned file:


JHtml::_('script', 'system/mootools-' . $type . '.js', false, true, false, false, $debug);
JHtml::_('script', 'system/core.js', false, true);

This method is better than the first one because we are only commenting the inclusion of the files, and not deleting the files. The downside of this method, however, is that we are changing a core file (behavior.php). At itoctopus, changing core files is always a last resort option when everything else fails!

Method #3: Develop a system plugin that will unload mootools

In our opinion, developing a system plugin that will unload the mootools library is the best option (and it’s what we do). This is because you won’t be deleting any file and you won’t be changing a core Joomla file. Additionally, this whole thing (disabling mootools) can just be reversed/applied by just disabling/enabling the plugin!

This plugin is fairly simple. The XML manifest file is straightforward (just copy and paste the XML file of any simple system plugin [such as the sef plugin], change the name, and modify the necessary parameters to reflect the name change of that plugin), as for the PHP file, it’ll only need the following 5 lines of code in the onAfterRender function:


$objDocument = &JFactory::getDocument();
$arrHeadData = $objDocument->getHeadData();
unset($arrHeadData['scripts'][JPATH_ROOT.DIRECTORY_SEPARATOR.'media'.DIRECTORY_SEPARATOR.'system'.DIRECTORY_SEPARATOR.'js'.DIRECTORY_SEPARATOR.'mootools-core.js']);
unset($arrHeadData['scripts'][JPATH_ROOT.DIRECTORY_SEPARATOR.'media'.DIRECTORY_SEPARATOR.'system'.DIRECTORY_SEPARATOR.'js'.DIRECTORY_SEPARATOR.'core.js']);
$objDocument->setHeadData($arrHeadData);

That’s it! Super simple, huh?

By the way, another advantage of using a system plugin is that it can be applied for specific components (and not the whole website). Also, with a system plugin, we can specify whether we want it to take effect on the frontend, the backend, or both (the code above will apply it on both because there’s no condition explicitly telling it to take effect exclusively on the frontend or exclusively on the backend).

But why would anyone want to disable mootools?

The main reason that anyone may want to disable mootools is if it’s causing conflicts on the website with another JavaScript library (which might be a previous version of mootools). We’ve seen this happening frequently on migrations from Joomla 1.5 to Joomla 2.5.

Now, if you’re reading the above and it seems like it’s written in a foreign language, then fear not, you’re certainly not alone, because this post is a bit technical! In any case, you can always contact us and we will definitely help you! Our rates are affordable, our work is swift and professional, and we really love to serve our clients!

4 Responses to “How to Disable Mootools in Joomla”
  1. Pingback by RokQuickCart Not Adding Items To Cart – How to Solve | itoctopus — May 31, 2013 @ 8:54 pm

    […] be different in your situation, so make sure you unset (remove) the right JavaScript path. Read here for more information on how to do remove a JavaScript library from a Joomla page. (Warning: that […]

  2. Comment by Mario — March 19, 2014 @ 8:22 pm

    I need faster backend loading because it takes about 1-2 minutes to save a module (or to change the template). Please I need help to solve this. I think you could disable moo tools for the back end?

  3. Comment by Fadi — March 19, 2014 @ 8:37 pm

    I don’t think the problem is in Mootools loading, because Mootools is loaded on each and every page in your backend. In any case, creating a system plugin (as described in the post) to disable Mootools will do the trick for the backend as well.

  4. Pingback by 20 Thoughts for a Better Joomla | itoctopus — March 26, 2014 @ 5:26 pm

    […] Thankfully, Joomla 3.x is using jQuery instead of MooTools, but Joomla 2.5 is still using MooTools (it can always be disabled though), which means once Joomla 2.5 is phased out, this problem will be no […]

Leave a comment