Loading Scripts Without Blocking

Aus Steve Souders neuem Buch: Even Faster Web Sites gibt es eine interessante Übersicht über Möglichkeiten JavaScripte einzubinden in seinem Blog:

There are six main techniques for downloading scripts without blocking:

  • XHR Eval - Download the script via XHR and eval() the responseText.
  • XHR Injection - Download the script via XHR and inject it into the page by creating a script element and setting its text property to the responseText.
  • Script in Iframe - Wrap your script in an HTML page and download it as an iframe.
  • Script DOM Element - Create a script element and set its src property to the script’s URL.
  • Script Defer - Add the script tag’s defer attribute. This used to only work in IE, but is now in Firefox 3.1.
  • document.write Script Tag - Write the HTML into the page using document.write. This only loads script without blocking in IE.

Possibly related posts (automatically generated)