Defer Loading of External JavaScript

You may also like...


  1. Tedy says:

    Hi Jose,

    Doesn't the HTML "defer" do just the same?
    as seen at:

    • Hendy Tarnando says:

      Hi Tedy, there are some differences. The JavaScript function above defers both the download and execution of a script and the script is executed on window's load event, whereas the defer attribute only defer the execution and the script is executed before DOMContentLoaded event. So it depends on your needs.

  2. Jose Luis says:

    Where should I put the function? head, body, /body?


Leave a Comment

Wrap your code block in [code] and [/code] tags.

This site uses Akismet to reduce spam. Learn how your comment data is processed.