Can I use <script defer> safely now?

Viewed 1920

From what I'm reading, the defer attribute on <script> is now widely supported but I never see it used or mentioned.

If you don't need to defer inline scripts and don't add scripts dynamically (which cause problems in IE9- and Safari 4-), it seems that you could use it reliably and have scripts run right before DOMContentLoaded in the specified order (which doesn't happen with async)

This is basically what most websites need: run a couple or more external scripts in sequence, on DOMready. For example:

<script defer src='jquery.js'></script>
<script defer src='jquery.some-plugin.js'></script>
<script defer src='my-scripts.js'></script>

Why isn't it widely used? Can I actually use it now?

2 Answers
Related