...

View Full Version : IE Iframe is empty?



Liquidus
09-23-2004, 09:31 PM
Hi Guys,

I'm in dire need of some help. I'm working on a Rich Text Editor script the uses document.createElement('IFRAME') to... well, create an iframe of course! I don't set any other attributes such as a 'src', which seems to work fine in both IE and Gecko browsers. After inserting the iframe in the page, I'd like to load some style properties into it. In Gecko, I simpy use iframe.getElementsByTagName('HEAD')[0] and append it with some textnodes, but here's the crazy part.

In IE, the iframe seems to come up totally empty! No head, no body, no nothing, so I'm kinda puzzled here as how to load anything into it... Now, I know all about createStyleSheet() and adding rules or using write() to put something in there, but I'd really like to do it in a more elegant, DOM compliant way!

Has anyone experienced something like this before?

brothercake
09-23-2004, 10:37 PM
Have you actually created a page inside the iframe, or are you just counting on the DOM of an assumed empty page? maybe it doesn't work because the document has no DOM.

But with that as a given, DOM 2 CSS is the way to create dynamic rules in the DOM, but its implementation is a bit sticky ... have a look at some past threads in this forum for info:

http://www.codingforums.com/showthread.php?t=18442
http://www.codingforums.com/showthread.php?t=29314

Liquidus
09-24-2004, 08:41 AM
Have you actually created a page inside the iframe, or are you just counting on the DOM of an assumed empty page? maybe it doesn't work because the document has no DOM.

It is indeed an assumed empty page (like i said, no src), but in Gecko browsers this doesn't seem to matter: it still has a DOM which I can play around with. In IE it's a different story: nothing in there at all!

glenngv
10-05-2004, 07:33 AM
Try setting the src to 'about:blank'

codegoboom
10-05-2004, 08:59 AM
I think about:blank is default, anyway (and viewing the source of the blank iframe does not reveal all). This does:

<iframe onload="alert(this.contentWindow.document.documentElement.innerHTML)"></iframe>

The created element must also be part of the parent document's content, before exposing those properties, from what I've found...

Liquidus
10-08-2004, 08:49 AM
Try setting the src to 'about:blank'

i had tried that before, no luck.... thanks though :thumbsup:

@codegoboom:
displaying the content is not the problem, the problem is it ain't there!

codegoboom
10-08-2004, 11:59 AM
displaying the content is not the problem, the problem is it ain't there!
oh really? that makes no sense... :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum