Defer javascript files by default

Prevent scripts blocking browser HTML parsing. The modern method instead of moving scripts to the end of the body tag as suggested in kanboard/kanboard#3829
This commit is contained in:
Michael Vickers
2018-06-09 11:03:03 +01:00
committed by Frédéric Guillot
parent 539e2bfd6c
commit 7c0a1a5fbd

View File

@@ -21,7 +21,7 @@ class AssetHelper extends Base
*/
public function js($filename, $async = false)
{
return '<script '.($async ? 'async' : '').' type="text/javascript" src="'.$this->helper->url->dir().$filename.'?'.filemtime($filename).'"></script>';
return '<script '.($async ? 'async' : '').' defer type="text/javascript" src="'.$this->helper->url->dir().$filename.'?'.filemtime($filename).'"></script>';
}
/**