I’ve spent quite some time on drupal_add_js
and didn’t manage to solve this. How can I load an external JavaScript script which will also have the defer
attribute?
I want to use this type of syntax:
drupal_add_js('http://example.com/whatever.js', 'external');
But it only produces:
<script src="https://example.com/whatever.js"></script>
I want the end HTML to be:
<script defer="defer" src="https://example.com/whatever.js"></script>