RE: dynamic generation of iframes and writing to them

"Maninder, Singh" <[email protected]> Thu, 29 Jun 2006 22:27:38 +0530
Newsgroups gmane.comp.web.dom.wdf
Message-ID <4D8B620F4FDA414982B23A3E7F6A8EF120896ABE@hydmail01.hyd.corp.int.untd.com>
Anyone?
 

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Maninder, Singh
Sent: Thursday, June 29, 2006 12:55 PM
To: [email protected]
Subject: [wdf-dom] dynamic generation of iframes and writing to them



Hello Everyone,

I would like to get some suggestions on a problem I am trying to address.

- I send a request to a 3rd party server (for ads) and a response is received from them.
- Currently, I display it inline on the page and things work fine but page loading is slow and the 3rd party response can mess up styles, js on my page.
- So, I want to capture this response and dynamically generate iframes and write the response into that. This way the other site wont mess up things on my site.

Now, the response is not always a simple plain gif, it could be an iframe with lots of stuff happening or it could be a URL that further calls some other ad.

So, this is what I did -

- Send a request to the server while the page is loading
- Capture the response by overwriting default document.write() because otherwise it would open a new output stream.
adContainer = "";
document.write = function(text){
adContainer += text;
};

- Then dynamically create the iframe -
function generateIframe(iframeId, sDocument) {

var tFrame = document.getElementById(iframeId);
var doc = tFrame.contentDocument;
if (doc == undefined || doc == null)
doc = tFrame.contentWindow.document;
doc.open();
doc.write(sDocument);
doc.close();
}

setTimeout("generateIframe('Left', adContainer)", 500);

Now, this works fine when I am trying to get one ad position.

Add to this a situation when I want to get 5 ad positions.

So, I send only ONE request.

Parse the response for different positions.

Create an iframe each for the positions (so like 5 iframes) and then write the responses into them.

I want to know if this is the right way to do it? Sometimes when the responses are overly complicated with functions, comments, cookies, blah blah the ad doesn't display.

Please let me know your thoughts.

Thanks,
Mandy.


 



[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Great things are happening at Yahoo! Groups.  See the new email design.
http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/9rHolB/TM
--------------------------------------------------------------------~-> 

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/