RE: cloneNode, Ad Rotation, caching, iframes - issue issues issuess
"Maninder, Singh" <[email protected]> Wed, 29 Mar 2006 23:57:53 +0530
| Newsgroups | gmane.comp.web.dom.wdf |
|---|---|
| Message-ID | <4D8B620F4FDA414982B23A3E7F6A8EF113409248@hydmail01.hyd.corp.int.untd.com> |
Gentlemen, Anyone? -Mandy. ________________________________ From: [email protected] on behalf of Maninder, Singh Sent: Wed 3/29/2006 5:14 PM To: [email protected] Subject: [wdf-dom] cloneNode, Ad Rotation, caching, iframes - issue issues issuess Hi, I need some guidance/expert views on an ad rotation script that I am writing. The idea is to build an ad queue (with only 1 ad in it) and caching of ads. So, by default on the page (centre space), I will show some static gif. As soon as the page loads, I'll fire a request to get an ad and push it into my queue. Next time any user action takes place (assuming he doesnt leave the page) I'll use the ad downloaded in the queue and display it in the centre space and fire another request to get the next ad and push it to queue. Since ads are got from a 3rd party partner this will speed up the ad display process as they would be served from the cache and when requested... However, I am facing an issue with it (script attached below). I declare 2 divs on my page - centralContent & nextAd. centralContent is where the ad should be displayed and nextAd div is where I am downloading the ad (queue/cache). So, I fire getNewAd() first that gets the new ad and places it's results in the nextAd div. It also clones it and keeps it for further use. Then when user clicks on get next ad, displayAd() is called, where I clear the centralContent & nextAd divs, use the cloned result and write it to centralContent (expecting it be quicker since it is served from cache) and fire getNewAd() again. But, the problem is that when getTag() is called, it writes an iframe to the page that calls the partner url that writes another\ 3 iframes in that iframe with 3 ads. I don't think cloneNode is able to capture that information as it's on another domain - right? So, how can I work around this problem? Any thoughts? Thanks, Mandy. Ad Rotation<br /> <div id='centralContent'>THE AD FROM THE QUEUE <br/> WILL GO HERE</div><br /><br /><br /> <div id='nextAd'>NEXT AD IN THE QUEUE <br />WILL APPEAR HERE</div><br /><br /><br /> <*cript> adContainer = ""; document.write = function(text){ adContainer = text; }; function refreshOriginalAdContainer() { document.getElementById('centralContent').innerHTML = ''; } function refreshNextAdContainer() { document.getElementById('nextAd').innerHTML = ''; } function appendToOrginal() { document.getElementById('centralContent').appendChild(tempAd); } function cloneExistingAd() { try { temp = document.getElementById('nextAd').cloneNode(true); tempAd = temp.childNodes[0]; } catch(e) { alert(e); } } function getNewAd() { try { //this will get the ad from the server it's not defined on this page getTag('WEBMAIL','TOPCENTER','LEADERBOARD','728','90'); document.getElementById('nextAd').innerHTML = adContainer; cloneExistingAd(); } catch(e) { alert(e); } } function displayAd() { try { refreshOriginalAdContainer(); refreshNextAdContainer(); appendToOrginal(); getNewAd(); } catch(e) { alert(e); } } getNewAd(); </*cript> <a href=# OnClick="displayAd(); return false;">Get New Ad</a> <br /><br /> Unsubscribe [email protected] List info http://www.quirksmode.org/dom/list.html ________________________________ YAHOO! GROUPS LINKS * Visit your group "wdf-dom <http://groups.yahoo.com/group/wdf-dom> " on the web. * To unsubscribe from this group, send an email to: [email protected] <mailto:[email protected]?subject=Unsubscribe> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> . ________________________________ [Non-text portions of this message have been removed] 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/