trigger on DOMContentLoaded instead of load event.  Handle errors #3765