htmlfacebookxhtmliframefacebook-iframe

Prevent iframe "This webpage is not available." error from displaying on website


Is there a way to prevent the error "This webpage is not available." from displaying within an iframe that displayed on another site?

For example, if I have a website and I want to display my Facebook fans in a box, one way to display it is with an iframe (typically Facebook supplied code). However, if for some reason Facebook is down or slow to respond (like it is right now), I get the following displayed on my website where the iframe should be displayed:

This webpage is not available.

The webpage athttp://www.facebook.com/plugins/likebox.php?id=xxxxxxxxxx&width=182&connections=6&stream=false&header=true&height=287might be temporarily down or it may have moved permanently to a new web address.

• More information on this error Below is the original error message Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.

If Facebook (or the other website) is not available, I'd be happy not displaying anything, or displaying a graphic of the same size (height/width), or a host of other alternatives EXCEPT displaying an error on my homepage! It makes my site look broken to users.

Any and all ideas are welcome! Thanks in advance


Solution

  • You can use the iframe's onerror="" property to do something creative. Consider this:

    <iframe src="foo.bar" onerror="this.location.reload();" />
    

    Hope this helps

    Edit: This no longer works.