is it possible to use theaddScript withasync="true"?
I found a hack that uses some clever quoting to trick the embed function, but it seems as if this could be a native feature:
$doc->addScript("//myscript.js", 'text/javascript" async="true');1 Answer1
If you have a look at the JoomlaaddScript function, it shows the following:
public function addScript($url, $type = "text/javascript", $defer = false, $async = false){ $this->_scripts[$url]['mime'] = $type; $this->_scripts[$url]['defer'] = $defer; $this->_scripts[$url]['async'] = $async; return $this;}$async is a boolean therefore the following should work for you:
$doc->addScript('//myscript.js', 'text/javascript', false, true);Thefalse is for$defer andtrue is for$async
Explore related questions
See similar questions with these tags.
