Skip to main content
11 events
when toggle format what by license comment
Oct 28, 2021 at 13:11 comment added mindplay.dk @Diodeus-JamesMacFarlane as others have commented, there is an error event, at least in all modern browsers - down voted for incorrectly stating "There is no error event for the script tag". Please update or remove this outdated/wrong answer.
Nov 15, 2018 at 2:43 comment added robocat Note I found I needed a combination of both the onload and onerror events. If there is a syntax error in the script (e.g. error in code, truncated source, or html error page), the onload event will fire and the onerror event will not fire. If the resource fails to be fetched (404) the onerror event will fire. In IE11 onerror also fired if escape was pressed before the file loaded (tested using fiddler and long timeout on script file in autoresponder). Here is a jsbin test: jsbin.com/jusoyob
Dec 22, 2017 at 8:59 comment added Nguyen Tran There is onerror evnt for script tag. It will fire when the resource not found.
Oct 27, 2016 at 20:26 comment added rogerdpack I guess there is one for HTML5 now?
Dec 26, 2011 at 21:18 comment added hippietrail But the timeout has to be provided by the page's coder right? So the coder might choose a different timeout to the browser, assume the script load timed out, and then have it succeed a bit later. Or not?
Feb 11, 2009 at 21:52 comment added Luca Matteis Ok, sorry for the downvote, seems like he's looking for both 404 error (which will work with your solution), and also javascript error, which will work with mine.
Feb 11, 2009 at 21:51 comment added Luca Matteis yes, true, that's why I asked to be more specific of what kind of error he's looking for.
Feb 11, 2009 at 21:49 comment added Diodeus - James MacFarlane Well, yes if the file LOADS and there is an error in the file itself, but if the file is not served up, the onload will never fire.
Feb 11, 2009 at 21:38 comment added Luca Matteis The "onload" listener will be fired even if there's a javascript error.
Feb 11, 2009 at 21:17 history edited Diodeus - James MacFarlane CC BY-SA 2.5
added 44 characters in body
Feb 11, 2009 at 21:12 history answered Diodeus - James MacFarlane CC BY-SA 2.5