Any difference between lazy loading Javascript files vs. placing just before </body>

Posted by mhr on Stack Overflow See other posts from Stack Overflow or by mhr
Published on 2010-05-25T00:31:34Z Indexed on 2010/05/25 0:41 UTC
Read the original article Hit count: 252

Looked around, couldn't find this specific question discussed. Pretty sure the difference is negligible, just curious as to your thoughts.

Scenario: All Javascript that doesn't need to be loaded before page render has been placed just before the closing </body> tag. Are there any benefits or detriments to lazy loading these instead through some Javascript code in the head that executes when the DOM load/ready event is fired? Let's say that this only concerns downloading one entire .js file full of functions and not lazy loading several individual files as needed upon usage.

Hope that's clear, thanks.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery