Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove all javascript in joomla ?

Tags:

php

joomla

I using code here

<head>
...
<?php 
$user =& JFactory::getUser(); 
if ($user->get('guest') == 1) { 
   $headerstuff = $this->getHeadData(); 
   $headerstuff['scripts'] = array(); $this->setHeadData($headerstuff); 
} 
?>
<jdoc:include type="head" />
</head>

But when run code is template load all javascript, how to fix it remove all javasccript in header in template joomla

like image 587
Hai Truong IT Avatar asked Nov 29 '25 10:11

Hai Truong IT


1 Answers

To remove a script you can use in your template:

$doc = JFactory::getDocument();    
unset($doc->_scripts[$this->baseurl.'/media/system/js/mootools-core.js']);
like image 129
Shaz Avatar answered Dec 02 '25 01:12

Shaz