Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect script defer support without testing

Tags:

javascript

Is there a reliable way of detecting if a browser supports the <script> attribute "defer" without testing? I'm not interested in creating multiple script blocks both defered and not and seeing which executes first. I'm looking for legitimate feature detection. "defer" in document.createElement("script") returns true just about everywhere, giving a lot of false positives.

like image 791
Lucent Avatar asked Mar 22 '26 12:03

Lucent


1 Answers

Based on Paul Irish's comprehensive research and article on script @defer document in his lazyweb-requests repository, I don't think defer behaves reliably enough to use even if you could feature detect it.

like image 133
Kevin Hakanson Avatar answered Mar 25 '26 02:03

Kevin Hakanson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!