Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Sep 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IE Iframe is empty?

    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?

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:

    DXHTML alternative to script-compiled CSS
    Is a CSS rule a text node?
    Last edited by brothercake; 09-23-2004 at 09:43 PM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #3
    New to the CF scene
    Join Date
    Sep 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by brothercake
    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!

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Try setting the src to 'about:blank'

  • #5
    Regular Coder
    Join Date
    Aug 2004
    Location
    codegoboom@yahoo.com
    Posts
    999
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...
    *this message will self destruct in n-seconds*

  • #6
    New to the CF scene
    Join Date
    Sep 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by glenngv
    Try setting the src to 'about:blank'
    i had tried that before, no luck.... thanks though

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

  • #7
    Regular Coder
    Join Date
    Aug 2004
    Location
    codegoboom@yahoo.com
    Posts
    999
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Liquidus
    displaying the content is not the problem, the problem is it ain't there!
    oh really? that makes no sense...
    *this message will self destruct in n-seconds*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •