Detect if the iframe content has loaded successfully.

Posted by skinssay on Stack Overflow See other posts from Stack Overflow or by skinssay
Published on 2010-12-28T19:51:10Z Indexed on 2010/12/28 19:54 UTC
Read the original article Hit count: 128

Hi, I have a widget that contains an iframe. The user can configure the url of this iframe, but if the url could not be loaded (it does not exists or the user does not have access to internet) then the iframe should failover to a default offline page.

The question is, how can I detect if the iframe could be loaded or not? I tried subscribing to the 'load' event, and, if this event is not fired after some time then I failover, but this only works in Firefox, since IE and Chrome fires the 'load' event when the "Page Not Found" is displayed.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about javascript-events