How to Stop Joomla 3 Loading Bootstrap 2 JavaScript

Posted in Joomla

It used to be easy to remove core JavaScript files from Joomla's output by unsetting the script at the top of your template's index file.

unset( $this->_scripts[ JURI::root( true ) . '/media/jui/js/bootstrap.min.js' ] );

For whatever reason, this doesn't work anymore with Joomla 3.9.

There are various plugins available which will unset core scripts, but an easy workaround to just remove the code is to override the file in your template by creating a blank file at the following location:

/templates/YOUR_TEMPLATE/js/jui/bootstrap.min.js

Joomla will then load this file instead of the core one.

It's not an ideal solution as the browser will still need to download a blank file (Make sure browsers are instructed to cache js files) but it is simple and foolproof without having to rely on a third party plugin.