Disable Joomla Scripts - Mootools, Caption from loading in Joomla Website

This article, will show how to disable Mootools, Caption, Jquery, Bootstrap scripts from loading in Joomla Website.

Joomla loads many scripts by default and many of these are necessary to make your website running, but sometimes in certain pages, you may want to stop them from loading. By removing those scripts, will make your pages load faster.

Disable Scripts Module

Free joomla module

The Code below which you add it in the index.php of your template, is to disable them in all pages of your site. Scripts added on code below will be disable form loading, so you can delete from the code the ones you want to show.

$doc = JFactory::getDocument();

$dontInclude = array(
'/media/jui/js/jquery.js',
'/media/jui/js/jquery.min.js',
'/media/jui/js/jquery-noconflict.js',
'/media/jui/js/jquery-migrate.js',
'/media/jui/js/jquery-migrate.min.js',
'/media/jui/js/bootstrap.js',
'/media/system/js/tabs-state.js',
'/media/system/js/core-uncompressed.js',
'/media/system/js/core.js',
'/media/system/js/mootools-core.js',
'/media/system/js/mootools-core-uncompressed.js',
);

foreach($doc->_scripts as $key => $script){
    if(in_array($key, $dontInclude)){
        unset($doc->_scripts[$key]);
    }
}

The only issue is that on some pages you may need those scripts, and by doing that, those scripts are disable in all your joomla website. For this reason, we create Disable Joomla Scripts a free module which you can use it to disable Mootools-more, Mootools-core and Caption from any pages of your site. You may find other plugins for this purpose, but with plugins you will Unload Scripts from all pages. The advantage of module, is that you can select the pages you don't need them.

Disable Scripts Joomla Module - Unload Mootools, Caption from your Joomla Website

disable scripts joomla module

To use the module is very easy.
Download the module for free and install it in your joomla website.
Navigate in Extensions - Module and click on Disable scripts module. 
Select a module position from the list of your current template, Show Title = Hide and Status = Published.
In "Menu Assignment" select "Only on the pages selected" or use "On all pages except those selected" and select the pages you want to unload them.
In "Disable scripts" tab, select which scripts you want to disable on those pages.

In Joomla frontend check the pages of your website where you disable them. Right click and "View Page source". On the source code, will not be the scripts you select on the module.

Disable Scripts Module

Free joomla module


Print   Email