Gaurav Manral
Gaurav Manral

Reputation: 600

How to make js file load asynchronously in joomla template file

I am using joomla. In it's template js are being called like following way-

 $doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/cscript.js', 'text/javascript');

I just want to add tag async to it. How should i do that..??

Upvotes: 1

Views: 1081

Answers (1)

Rikesh
Rikesh

Reputation: 26431

You need to pass 4th param with boolean true,

$doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/cscript.js', 'text/javascript', false, true);

Upvotes: 1

Related Questions