Check if 'onload' would have fired already?

Posted by thomasrutter on Stack Overflow See other posts from Stack Overflow or by thomasrutter
Published on 2010-03-19T00:25:17Z Indexed on 2010/03/19 0:31 UTC
Read the original article Hit count: 321

Hello,

I have a situation where I'd like to set an onload handler for a script element, but it is possible that the script element has already loaded before I do so. If it's already loaded, I'd like to detect that and run my handler immediately.

What would be a reliable way of checking a script element's onload state after the fact?

BTW I know that IE uses readyState instead of an onload event so I don't need help for that.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about javascript-events