On Sat, 5 Nov 2016 14:35:07 -0700 (PDT), justaguy wrote:
> Per subject line, thanks.
If you meant from the web browser or client-side JavaScript, monitor the
SCRIPT element's `load` and `error` events, and monitor the global object's
`error` event.
The SCRIPT element's `load` event will fire if the script code has been
loaded, parsed, and executed.
The SCRIPT element's `error` event will fire if the script code has failed
to be loaded.
The global object's `error` event will fire if a script code has an
unhandled error.
You'll need to have a count of the total number of external scripts either
at design time (i.e. server side), or at run time (i.e. client side). If
from client side, use the `document.scripts` to determine the number of
external scripts.
If you load the JavaScript files using SCRIPT elements as external scripts,
then you'll need to monitor the events using the `onload` and `onerror`
attributes of the SCRIPT elements because the resources may load very fast
especially if you have fast network or if you serve the files from a local
web server. If you monitor the events using the SCRIPT element object's
`onload`/`onerror` properties, or using `addEventListener()`, the events may
have already been fired before you have the chance to attach the event
listeners.
If you load the JavaScript files using XHR, then you'll have to also listen
to the XHR's `load` and `error` events, in order to determine whether a
JavaScript file is still loading or not.