Recently, I tried to use jQuery, as a way of dynamically loading all the scripts that a certain page requires. Instead of utilizing script tags in the header section, using a simple
$.getScript("script.js"); loads the same code, what’s more, this code is loaded asynchronously, which helps improve loading performance. The only problem is that loading scripts this way, makes them unavailable for debugging.
Debugging dynamically included script files presents some special challenges on it’s own. The primary being that that the web is basicly not a structured enviroment, like a folder on disk, and references to files and/or code is can be very intermittent.