Forum Moderators: open

Message Too Old, No Replies

Display "Please wait" message while an iframe is loading

         

total n00ber

12:12 am on Jan 4, 2007 (gmt 0)

10+ Year Member



Referring to the Accepted Answer here: <url removed>
Would it be possible to have the current page check to see when the iframe is loading something? I have an iframe that loads as "about:blank", but when the location changes, I would like the "Please wait" message to display.

Is something like this even possible?:

if (window.myiframe.getElementById) { 
//hide 'Please wait' message
}
else {
if (window.myiframe.layers) {
//hide 'Please wait' message - NS4
}
else {
if (window.myiframe.all) {
//hide 'Please wait' message - IE4
}

What about making an "iframe listener" so that whenever window.myiframe.location!= "about:blank", it would display the please wait message?

[edited by: encyclo at 1:24 am (utc) on Jan. 4, 2007]
[edit reason] See terms of service [webmasterworld.com] [/edit]

Trace

3:20 pm on Jan 4, 2007 (gmt 0)

10+ Year Member



In you main page, create a layer with your "Please wait" message and set it to hidden. When a new page loads in your frame, have it set the layer to visible - and once loaded set it back to hidden.

total n00ber

5:14 pm on Jan 4, 2007 (gmt 0)

10+ Year Member



When a new page loads in your frame, have it set the layer to visible...

I can't. The page loading in the iframe is on a different domain.

Any other solutions?

Trace

8:51 pm on Jan 4, 2007 (gmt 0)

10+ Year Member



You need something to notify the "loading" message that the page has finished loading or else it's not going to be very accurate.

If you don't care about accuracy then just load the layer on the onclick of the link and have it close with a timer. But what's the point?

total n00ber

10:42 pm on Jan 4, 2007 (gmt 0)

10+ Year Member



Nevermind, I'm gonna play around with:

if (myiframe.document.readyState!= "complete") {
// show
} else {
// hide
}