View Full Version : Detect iframe fail to load

29 Nov 2011, 1:43 AM
Does anyone know of an effective way to detect whether an iframe loaded or whether it got a 404 / 500 / etc?

I have a TabItem with setUrl set, that I point at user documentation. The problem is that sometimes the user is using my application from a place that doesn't have access to the internet. In that case I would like to properly handle the error rather than showing a firefox / chrome / ie 404 page.

Any tips on how I could go about this?

6 Dec 2011, 12:19 AM
No-one have any ideas?

6 Dec 2011, 12:31 AM
well you can send a different request first using RequestBuilder and ask for .. let's say .. a boolean. If the boolean returns (and response.getStatusCode() == 200) then render the iFrame. If not, handle the FAIL part .. cause it's obvious that the IFrame will fail too.

6 Dec 2011, 12:34 AM
Good idea. Thanks!