7 ms·
Very nice article indeed. One commonly used variant I missed in the article and I'd be interested what it's positive/negative aspects are (if there are differe
by mweibel 12y ago
Very nice article indeed.
One commonly used variant I missed in the article and I'd be interested what it's positive/negative aspects are (if there are differences at all):
<script>
var script = document.createElement('script');
script.src = "http://example.com/awesome-widget.js";
script.async = true;
document.getElementsByTagName('head')[0].appendChild(script);
</script>
(Note the additional async param)
- d_j_s 12y agoAll browsers since FF 3.6 default inserted scripts to async=true http://mathiasbynens.be/notes/async-analytics-snippet http://mathiasbynens.be/notes/async-analytics-snippet
- radio4fan 12y agoJust tried it, and it makes no difference. Still waits for the CSS to load before requesting the script. At least, in Chrome.
- igrigorik 12y agoIt's a noop.