[thelist] SOLVED! Sort of: JS - loading an external page

Alister Cameron alister at cameron.org
Tue Mar 12 20:44:00 CST 2002

Ok, further info for those who care! I came up with some answers eventually.
Thanks to those who suggested stuff.

It can be done easily for DOM browsers. That's descibed here (with code):


This may be limited to XML files in Mozilla, I'm not sure.

But there you go. I have used the XMLHTTP object server-side, but of course
it's also there client-side for DOM versions of IE! So use it! It's
amazingly powerful!

- Alister.

-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Alister Cameron
Sent: Sunday, 10 March 2002 1:40 AM
To: thelist at lists.evolt.org
Subject: [thelist] JS - loading an external page


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

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?!?!


- Alister Cameron
Cameron Creative.

For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !

More information about the thelist mailing list