Saturday, 17 May 2008

Remove mootools.js and caption.js from Joomla! 1.5

If you are using Joomla! 1.5 you may have observed that Joomla! loads 2 javascripts files. You might use them, or not. But if you don't use it, why don't remove it ?

MooTools are great, but it's a waste of bandwidth to load 2 files that you don't even use:

mootools.js and caption.js

You can simply remove to load those 2 files by inserting a few lines of PHP code into your index.php's theme file.


// Remove mootools.js and caption.js
$user =& JFactory::getUser();
if ($user->get('guest') == 1) {
$headerstuff = $this->getHeadData();
$headerstuff['scripts'] = array();
$this->setHeadData($headerstuff);
}
?>


After those lines insert the jdoc head. (jdoc:include, etc)

I am pretty sure that this tip I've founded on the Internet, but I'm not sure at what site. I found these lines in one of my Joomla!'s theme files. If you know the site, please leave a comment so I can give proper credits :-)

UPDATE: Credits: blog.highub.com - Remove Mootools From Joomla Header

1 comments:

Anonymous said...

Thanks a lot !!!
This is a useful information !