Re: cloneNode, Ad Rotation, caching, iframes - issue issues issuess

"Ian Petersen" <[email protected]> Wed, 29 Mar 2006 17:15:49 -0500
Newsgroups gmane.comp.web.dom.wdf
Message-ID <[email protected]>
> Any thoughts on this?

Unfortunately, not really.  I have found iframes to be problematic in the past.

I once built an application that emulated tabs.  Clicking on a tab
would use element.removeChild() to "hide" the content of the current
tab and the element.appendChild() to "show" the content of the new
tab.

If a tab's content contained an iframe, switching away from that tab
and then back to it would leave the iframe empty.  I had to refresh
the iframe's content every time the containing tab was selected to
work around this problem, which is exactly what you don't want to do.

I can only think of two possible hacks for you, neither of which
sounds appealing to me, and both of which might fail if the browser
decides the approach is a security problem.

The first is to write lots of Javascript that scrapes the HTML out of
the nested iframes and copies it into a div that's on your page.  If
you do that, though, you'll run into _lots_ of problems trying to make
sure that nested stylesheets and scripts get copied properly.  I doubt
it would be worth the effort, and the browser might not let you scrape
the content in the first place.

The second is to create this structure:

 body
   div <!-- the displayed ad -->
     iframe  <!-- pointing to _your_ domain -->
       iframe    <!-- ad one -->
       iframe    <!-- ad two -->
       iframe    <!-- ad three -->

   div <!-- the cache -->
     iframe   <!-- pointing to your ad server -->
       iframe    <!-- pointing wherever -->
       iframe    <!-- ditto -->
       iframe    <!-- ditto -->

So, now the ads you're displaying are iframes that you control.  The
next step is to scrape the contents of the nested iframes in the cache
and use iframe.document.write() to copy it into the nested iframes
that you control.  Again, this might not work if the browser disallows
scraping content from iframes you don't control, which seems likely to
me.  At least with this approach you don't have to worry about nested
stylesheets or scripts because the nested iframes should let them
"just work".

If those don't work, I'm out of ideas.

Good luck,
Ian

--
Tired of pop-ups, security holes, and spyware?
Try Firefox: http://www.getfirefox.com


Unsubscribe
[email protected]

List info
http://www.quirksmode.org/dom/list.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wdf-dom/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/