Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

innerHTML equivalent of an iframe element?

281 views
Skip to first unread message

tsuka...@gmail.com

unread,
Apr 22, 2007, 6:35:43 PM4/22/07
to
Is it possible to get the contents of an iframe (I need a method that
allows me to get the generated HTML code of an XML file that was
transformed by an XSL file)?


Thanks in advance! :)

shimmyshack

unread,
Apr 22, 2007, 7:25:24 PM4/22/07
to

have you thought to transform the xml to json and just push it to a
handler in the parent frame ala googlemail

Peter Michaux

unread,
Apr 22, 2007, 8:10:52 PM4/22/07
to

I've just been reading the YUI connection library <URL:http://
developer.yahoo.com/yui/connection/>. The library has the following
two lines of code to read the contents of an iframe when the iframe
has finished loading. "io" is the frame, and "obj" is just where they
want to store the contents of the frame.

obj.responseText = io.contentWindow.document.body ?

io.contentWindow.document.body.innerHTML :
null;
obj.responseXML = io.contentWindow.document.XMLDocument ?

io.contentWindow.document.XMLDocument :
io.contentWindow.document;

I really don't know the quality of these two lines of code.
Determining that is my next job. Anyone have any thoughts?

Peter

tsuka...@gmail.com

unread,
Apr 23, 2007, 7:56:35 AM4/23/07
to
On Apr 23, 1:25 am, shimmyshack <matt.fa...@gmail.com> wrote:
> have you thought to transform the xml to json and just push it to a
> handler in the parent frame ala googlemail
But the entire point of doing it this way is have the browser use its
built-in XSL transformation, so that I don't have to do it with a
JavaScript library like Sarissa. This makes the site considerably
lighter since it's all part of the browser.

On Apr 23, 2:10 am, Peter Michaux <petermich...@gmail.com> wrote:
> I've just been reading the YUI connection library <URL:http://
> developer.yahoo.com/yui/connection/>. The library has the following
> two lines of code to read the contents of an iframe when the iframe
> has finished loading. "io" is the frame, and "obj" is just where they
> want to store the contents of the frame.
>
> obj.responseText = io.contentWindow.document.body ?
>
> io.contentWindow.document.body.innerHTML :
> null;
> obj.responseXML = io.contentWindow.document.XMLDocument ?
>
> io.contentWindow.document.XMLDocument :
> io.contentWindow.document;
>
> I really don't know the quality of these two lines of code.
> Determining that is my next job. Anyone have any thoughts?
>
> Peter

Thanks, I haven't thought of that :) I'll give it a try in a few
hours ;p

tsuka...@gmail.com

unread,
Apr 23, 2007, 7:58:12 AM4/23/07
to

On the other hand, it seems somebody already "stole" my idea for
simpler AJAX :(

tsuka...@gmail.com

unread,
Apr 23, 2007, 8:02:47 AM4/23/07
to
Oh er, shimmyshack, it seems I misunderstood you.

That would be a pretty good idea, yes, but the HTML that you get as a
result is supposed to be taken and put in a container in the parent
frame via DOM or innerHTML :p

0 new messages