Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Async and Defer: list what happens when both attributes are used on a script tag. #95

adamcbrewer opened this Issue · 6 comments

3 participants

Adam Brewer Paul Irish Trevor Burnham
Adam Brewer

async as less support than defer, but async takes priority over defer.

Might also be worthwhile mentioning the implications if multiple scripts have these attributes; the order of script execution cannot reliably be determined when using async.

Paul Irish

defer DOES NOT WORK unless your site completely doesnt care about IE9.


Adam Brewer

Thanks @paulirish – what a shame. Took a while to get through the issue you referred to, but it was worth it.

Would the blanket of "don't use" flag still stand for a synchronous Modernizr script in the head and a defer script in the footer that depended on it?

Additionally, would there be any benefit to a site using a single defer script which used some sort of require.js process for other scripts within?

I'll send @trevorburnham a link to your h5bp issue – recently read his book: Async Javascript. Unless I completely missed it, he might want to be aware of it.

Adam Brewer adamcbrewer reopened this
Trevor Burnham

Thanks for cc-ing me on this, Adam. I was unaware of the defer bugs described in that thread. It sounds like it's safe to use defer with scripts that don't perform DOM manipulation, though.

Paul Irish
Adam Brewer

Cheers for the answers Paul. If I come across this somewhere else I'll try update and link them through to the h5bp issue.

Paul Irish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.