开发者

Detect script defer support without testing

开发者 https://www.devze.com 2023-01-16 07:11 出处:网络
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 开发者_如何学JAVA

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 开发者_如何学JAVAand 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消