Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple.
The most important thing to remember when implementing this is the order in which requests are processed and rendered on a web page. Server-side code is always processed first, a response is then sent down to the client and presented on the browser in this case. So the following code:
Response.write "<p>Hello World 1</p>"
<p>Hello World 2</p>
Response.write "<p>Hello World 3</p>"
Would indeed render as follows:
Hello World 1
Hello World 2
Hello World 3
The first thing to note is that the ASP code was processed first, and was then rendered as HTML. The same principles apply when attempting to hide/show a progress indicator for an iFrame.
Here is a working example. Copy the following code and paste it into "parent.html":
And take the following code and paste it into"iframepage.html":