Categories
Joomla

Remove Mootools in Joomla

Mootools.js and caption.js are two javascript libraries that are mainly used in the administrator control panel. Most of the Joomla templates don’t use it. The size of the two library files are about 75k and those decrease the speed of the website. Sometimes it conflicts with few modules that are installed and the modules don’t work properly.
These are the two lines which load in the joomla website.

<script type="text/javascript" src="/media/system/js/mootools.js"></script>
<script type="text/javascript" src="/media/system/js/caption.js"></script>

So to disable the two lines of code we need to write the following code on the top of the index.php file of our template.

 <?php
//remove mootools.js and caption.js
$headerstuff=$this->getHeadData();
reset($headerstuff['scripts']);
foreach($headerstuff['scripts'] as $key=>$value)
{ unset($headerstuff['scripts'][$key]); }
$this->setHeadData($headerstuff);
?>

After inserting the lines of codes, refresh the frontend and clear the joomla cache.If you have problems with mootools on your Joomla website, ask us for assistance.