joomla- How to remove unwanted js files from page
I have used plugins some pages so many js files are included in all pages
There are two ways that I am aware of:
1) get an instance if the document object and remove the js files (you could do that in a plugin) :
<?php
//get the array containing all the script declarations
$document = JFactory::getDocument();
$headData = $document->getHeadData();
$scripts = $headData['scripts'];
//remove your script, i.e. mootools
unset($scripts['/media/system/js/mootools-core.js']);
unset($scripts['/media/system/js/mootools-more.js']);
$headData['scripts'] = $scripts;
$document->setHeadData($headData);
?>
2) remove js files directly from your templates index.php :
<?php unset($this->_scripts['/media/system/js/mootools-core.js']); ?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With