| 3:01 pm on Jul 17, 2011 (gmt 0)|
If you are controling the content of the iframe from the outer page then you could probably hide the iframe when you change the iframes src and show it again in the onload event of the iframe? You could then show anything you like whilst the iframe is hidden.
| 9:14 am on Jul 18, 2011 (gmt 0)|
no unfortunately the iframe location is changed within the iframe. I've seen a site achieve it somehow but it was part of their payment pages (3D secure), can't remember where now though.
| 9:41 am on Jul 18, 2011 (gmt 0)|
|...the iframe location is changed within the iframe. |
Is the iframe content on another domain? Although whether internal/external I would have thought the only (reliable) way to display a loading image would be from the pages in the iframe themselves?!
Can the outer document detect when the source URL of the iframe changes? I would have thought it would need to be polling continuously if this was possible?
| 8:29 am on Jul 19, 2011 (gmt 0)|
yes it's all external domains
| 3:56 pm on Jul 19, 2011 (gmt 0)|
About all you can do is use one of the bazillion lightboxes out there the create an overlay, though I don't know how you'd get the trigger that the frame has fully loaded. As mentioned, cross frame scripting on other domains is not allowed (would be a serious security flaw if you could.)
| 9:59 am on Jul 23, 2011 (gmt 0)|
I'm coming to this late, but recall that except in ie, iframe will accept a background-image (and also a background-color), so it is quite possible to set a "loading" image/animated gif if desired. The issue would be that the background-color of the iframe content is stacked higher than the background-image, which may mean that the image is obscured quite quickly.
Unfortunately the default background for iframes in ie is #fff. This can be overcome by setting allowtransparency="true" on the iframe element, but that is proprietary and will not validate. Note the msdn documentation [msdn.microsoft.com] states that the background-color on the iframe content must also be set to transparent, but having tested in ie6-8 (not 9), that does not seem to be required.