Interacting with IFRAME contents

B

bs9999

I'm using IFRAME to connect back to my ASP.NET page in order to fetch
the FreeBox HTML Editor html contents and scripts (i do this apprach
because the html editor is fairly heafty to send to the user when most
dont use it on our site instead deferring to a user request before
actually sending down the code via AJAX or in this case an IFRAME).
From there I plan on scraping the IFRAME via Javascript to gather then
append all script tags and relevant html elements into my main page's
DOM, outside of the iframe.

I've used iframe.contentDocument() and then myiframedoc.body.innerHTML
and getElementsByTagName("head")[0] / ("body")[0] to extract the
contents from the iframe. I am able to see the code and nodes and even
append it to my main page (ie. add <script> nodes from the iframe into
my main page's head area). For the most part nothing happens. I was
expecting the downloaded IFRAME contents (which is hidden from view)
would visibly appear in my main page. This is not the case. Nothing
happens at all. It's as if FF and IE refuse to kickstart their
rendering engines to visually acknowledge the new nodes. Weird.

At times I have spotted IE even making the attempt to redload a <script
src> element once it has been newly added to my main page. It
downloads fine but again nothing happens. I try to access declared
variables within the script block and only get back Undefined. Im
still gathering the details but it seems like all script blocks and
<link> elements are the problems between the iframe and my main js app.

Can someone please tell me how Im going about accessing the DOM
incorrectly?

Thank you.
 
A

ASM

(e-mail address removed) a écrit :
Can someone please tell me how Im going about accessing the DOM
incorrectly?

I think your browsers believe you are trying to do cross-domain
(that is not tolerated) and it is exactly what you do :
domain of FreeBox <-> localhost
 
B

bs9999

No, this is all done on my own server. Im aware of cross domain
restrictions and this is not the case as alreadt mentioned
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top