JavaScript #1: Loading...
JavaScript #2: Loading...
JavaScript #3: Not Called Yet
JavaScript #4: Not Called Yet
JavaScript #5: Not Called Yet
JavaScript #6: Not Called Yet
JavaScript #7: Not Called Yet
JavaScript #8: Not Called Yet
This page demonstrates a simple function that loads JavaScript in a way that avoids the blocking nature of HTML <script> elements. This version of the loader improves on the previous in terms of Firefox behavior, where if not addressed can potentially block the page.
JavaScript 1 and 2 were called in the head, take note that there was no blocking, and you saw this content just fine!
Calling JavaScript #3 and #4 using the loader, inline...
Interesting, notice Firefox waited until scripts #1 and #2 finished before #3 and #4 started loading.
We'll now write out the code for #5 and #6, which will be delayed until #3 and #4 finish.
This text was blocked until the #3 and $4 script block finished loading, and #5 and #6 finally start!
Calling JavaScript #7 and #8 the old fashioned way...but they won't start until #5 and #6 finish.
This is some text that was blocked...
Load completed in seconds.