Mootools is a lightweight javascript framework used in Joomla 2.5. Your Joomla website will by default include both mootools-core.js (92.9 KB) and mootools-more.js (233 KB). Mootools is used mostly in your Joomla Admin Dashboard, it is not used often in Joomla templates.

UPDATE - 2012.05.11
After several months of testing Joomla 2.5 and various components, we have found that if you disable mootools you may break a lot of features. For example, while testing VirtueMart, we lost all search filter functionality. After enabling mootools, the problems were resolved. Therefore, we do not recommend disabling mootools. DISABLE MOOTOOLS AT YOUR OWN RISK.

If your Joomla website does not use mootools, it may benefit you to disable mootools. If you disable mootools in Joomla 2.5, you can:

  • Increase page download speed by removing 325.9 KB of un-needed javascript code
  • Reduce the number of conflicts caused between mootools and other javascript frameworks, such as jQuery
Steps to disable MooTools in Joomla 2.5:
  1. Using your favorite file editor, open for edit:
    libraries/joomla/document/html/renderer/head.php
  2. Find this code at line 151:
    // Generate script file links
    foreach ($document->_scripts as $strSrc => $strAttr)
    {
        $buffer .= $tab . '<script src="' . $strSrc . '"';
        if (!is_null($strAttr['mime']))
        {
            $buffer .= ' type="' . $strAttr['mime'] . '"';
        }
        if ($strAttr['defer'])
        {
            $buffer .= ' defer="defer"';
        }
        if ($strAttr['async'])
        {
            $buffer .= ' async="async"';
        }
        $buffer .= '</script>' . $lnEnd;
    }
    

    ... and update it to include the code (highlighted in green below)

    // Generate script file links
    foreach ($document->_scripts as $strSrc => $strAttr)
    {
        // Code to disable mootools for your site (still loads it for your admin)
        // Written by Brad Markle w/ InMotionHosting.com
        $ex_src = explode("/",$strSrc);
        $js_file_name = $ex_src[count($ex_src)-1];
        $js_to_ignore = array("mootools-core.js","mootools-more.js");
        if( in_array($js_file_name,$js_to_ignore) AND substr_count($document->baseurl,"/administrator") < 1 AND $_GET['view'] != 'form')
            continue;
    
        $buffer .= $tab . '<script src="' . $strSrc . '"';
        if (!is_null($strAttr['mime']))
        {
            $buffer .= ' type="' . $strAttr['mime'] . '"';
        }
        if ($strAttr['defer'])
        {
            $buffer .= ' defer="defer"';
        }
        if ($strAttr['async'])
        {
            $buffer .= ' async="async"';
        }
        $buffer .= '</script>' . $lnEnd;
    }
    
  3. After saving the changes above, clear any cache that you have set and test your Joomla website and your Joomla Admin Dashboard. If you view the source code, mootools should not load on your site but it will load in your Joomla Admin Dashboard.

Notes:

If your Joomla 2.5 Admin folder is not named "administrator", update this section of code with the correct folder name:
substr_count($document->baseurl,"/administrator")

If you would like to disable other scripts, such as caption.js, add it to the js_to_ignore array, as in:
$js_to_ignore = array("mootools-core.js","mootools-more.js","caption.js");

If you are experiencing any issues due to this modification, feel free to post a comment at the bottom of this page and we'll be happy to review.

UPDATE - 2012.04.04
While writing other Joomla 2.5 tutorials, I've learned that the frontend article submission form requires mootools. If you disabled mootools and clicked the "Save" button when trying to save an article, nothing would happen. I updated the code above to include:

AND $_GET['view'] != 'form'
If you are on a form on your website, this line of code will allow mootools to load.
Continued Education in Course Joomla 2.5
You are viewing Section 2: 302: Joomla 2.5 - disable mootools
Section 1: 301: How to enable ReCaptcha in Joomla 2.5
Section 3: 303: How to use the Joomla 2.5 Redirect Manager
Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Joomla Community Google+ Hangout #3

June 3rd, 2014

Thank you @RustyJoomla for letting me speak on the Joomla Community Google+ Hangout!

Click here to watch!

n/a Points
2014-03-06 1:42 pm

It is always a bad idea to modify core files as they may be overwritten on updates.

n/a Points
2014-06-07 8:26 am

After disabling mootools some features stop working for me. lightbox for instance. when I click an image that should open as a lightbox, it directly navigates to the jpg file itself. enabling mootools solves the problem.

Staff
18,098 Points
2014-06-09 2:25 pm
Hello Hessam,

Thank you for the information. As said in the disclaimer on the article, it may break several features. It seems that Lightbox is one of them. This may be helpful for anyone looking to disable mootools.

Kindest Regards,
Scott M
n/a Points
2014-07-23 7:41 am

While I agree that it's generally a bad idea to modify your core files, keeping good backups and proper documentation should mitigate the issues that crop up from update overwrites.

Also...

There are other lightbox options that do not require mootools. Personally I find it's a lot easier to find a different solution then to figure out how to solve the host of conflicts that arise when you're trying to use mootools AND jQuery, and given the choice, I'd rather keep jQuery.

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

4 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!