[thelist] JS - loading an external page

Alister Cameron alister at cameron.org
Sat Mar 9 15:44:08 CST 2002


Folks,

I am testing a concept here, which I'd very much like to see working... but
I'm stuck.

In a block of JS (in the HEAD of my HTML page), I load in an external HTML
page into an invisible IFRAME (IE) or LAYER (NS).

Now, if all I wanted to do was display it on the page, I'd be fine. No
problems... and I can find plenty of examples of that on the web.

BUT, the trickiness here, is that I need to consider the contents of the
externally loaded HTML page *BEFORE* any more of the HTML page is parsed by
the browser (I'm actually not wanting to display it at all, in this
instance).

What's happening now is that the browser continues parsing and gets to some
JS further down the page which throws an error because in the sequence of
things, the external page is not loaded yet.

I DO NOT have the option of an onload function for analyzing the contents of
the external file... that would be too late, of course, since onload only
happens at the completion of parsing the HTML page.

So I'm stuck. I even tried a setTimeOut, but the browser goes straight past
that and continues rendering the rest of the page...

What I need is some way in JS to WAIT (i.e. do no further parsing/rendering
of the page) until that external file has been loaded.

I suspect that may mean putting an onload function into the external page
which says "I'm finished" to the parent page, but I can't nut that out.

Any ideas anyone?

Confused yet?!?!

Thanks,

- Alister Cameron
Cameron Creative.




More information about the thelist mailing list