Skip to main content
tring to make the question clearer
Source Link
Robert Went
  • 361
  • 2
  • 10

I'm trying to unset all javascript declarations in the docdocument head but only the core gets unset.

By this I mean inline javascript that is added by 3rd party extensions using ->addScriptDeclaration(), and anythingnot javascript files that are added using ->addScript().

If I dump

$doc = JFactory::getDocument();
var_dump($doc->_scripts);

then all Javascript files added by an extension is still outputted in the headJoomla core and 3rd party extensions are shown.

If I dump

$this$doc = JFactory::getDocument();
var_dump($doc->_script['text/javascript']);

then itThen only contains the core script. Even dumpingjavascript is shown, eg:

string(79) "jQuery(window).on('load',  function() {
            new JCaption('img.caption');
        });"

Anything added by 3rd party extensions is not included and still gets outputted to the whole document doesn't show anythinghead.

Is it possible to intercept 3rd party script in the template or is it added at a later date and can only be done by a plugin at a certain event?

I'm trying to unset all javascript declarations in the doc head but only the core gets unset and anything added by an extension is still outputted in the head.

If I dump

$this->_script['text/javascript'])

then it only contains the core script. Even dumping the whole document doesn't show anything.

Is it possible to intercept 3rd party script in the template or is it added at a later date and can only be done by a plugin at a certain event?

I'm trying to unset all javascript declarations in the document head.

By this I mean inline javascript that is added by 3rd party extensions using ->addScriptDeclaration(), and not javascript files that are added using ->addScript().

If I dump

$doc = JFactory::getDocument();
var_dump($doc->_scripts);

then all Javascript files added by the Joomla core and 3rd party extensions are shown.

If I dump

$doc = JFactory::getDocument();
var_dump($doc->_script['text/javascript']);

Then only the core javascript is shown, eg:

string(79) "jQuery(window).on('load',  function() {
            new JCaption('img.caption');
        });"

Anything added by 3rd party extensions is not included and still gets outputted to the head.

Is it possible to intercept 3rd party script in the template or is it added at a later date and can only be done by a plugin at a certain event?

Source Link
Robert Went
  • 361
  • 2
  • 10

Unsetting javascript added to head data by ->addScriptDeclaration() in template

I'm trying to unset all javascript declarations in the doc head but only the core gets unset and anything added by an extension is still outputted in the head.

If I dump

$this->_script['text/javascript'])

then it only contains the core script. Even dumping the whole document doesn't show anything.

Is it possible to intercept 3rd party script in the template or is it added at a later date and can only be done by a plugin at a certain event?