Adding <script> asynchronously

Steve Souders comes up with what should be the definitive way to add script into a web page. This is particularly relevant to widget and third party code develoers.

Steve Souders comes up with what should be the definitive way to add script into a web page. This is particularly relevant to widget and third party code developers.

Part of the acceptance criteria for third party code in an e-commerce environment is its lack of impact on performance and other code in the page

The article appendChild vs insertBefore I hope will be part of a set of best practice conclusions from his P3PC series.

To augment your reading of this article it is also worth reviewing the information on browser “busy” indicators that was contained in the lesson Load Scripts Without Blocking from his CS193H Stanford class.

Based on the above, I tend to use XHR injection for local scripts to avoid the Firefox busy indicator and script DOM element insertion for offsite 3rd party code.