This is almost exactly the same as placing the code to the bottom of the page (without iframes) and replacing the placeholders with the real content after dom:load.
The difference is that e.g. Adsense doesn't like "fake" iframes (because it's generating ads depending on the page's content). Synchronous I/O at the bottom of the page is an acceptable trade-off in my opinion. The only downside is that you need to have a good management of such scripts because you have to place the placeholder and the real ad separately depending on the current page. 2010/12/15 Nicola Rizzo <[email protected]>: > I solved this problem using iframes: after the page load my script > creates an iframe for every banner, so the load time is not affected > by the external scripts. > The iframe's src points to a page containing the original synchronous > script, wrapped in a div, ie: > <div id='wrapper'> > <script type='text/javascript' > src='http://external/sync/script.js'></script> > </div> > When the iframe's onload is fired, my handler copies the > document.getElementById('wrapper').innerHTML to the main document (in > a parent.document.getElementById(íframecontainer') or something like > that). > Hope this helps, > Nicola > > On Wed, Dec 15, 2010 at 5:26 PM, Mads Erik Forberg <[email protected]> wrote: >> Hello, >> have any of you worked out a async document.write that works with >> ad-hosting-services? >> My employer uses AdTech, and some times they load ads from yet another >> ad-hosting-service, so we get many layers of document.write >> >> It works fine for the first ad-service to do this stuff: >> [code] >> var oldWrite = document.write, >> content = ''; >> document.write = function(d) { >> content += d; >> } >> [/code] >> >> But when the script from the AdTech loads, it loads yet another script that >> uses document.write from another service. And that document.write goes back >> to its old self. >> Like this: >> Initial call: >> <script src="path-to-adtech.js"></script> >> In that script its: >> document.write("<script src=\"another-provider.js\"><\/script>"); >> And in that script: >> document.write("Print out fancy ad"); >> >> So what I want is a document.write that stays persistant over all the >> layers. >> >> >> Anyone encountered this? Solutions? Hacks? >> >> >> Best regards, >> Mads Erik Forberg >> >> -- >> To view archived discussions from the original JSMentors Mailman list: >> http://www.mail-archive.com/[email protected]/ >> >> To search via a non-Google archive, visit here: >> http://www.mail-archive.com/[email protected]/ >> >> To unsubscribe from this group, send email to >> [email protected] >> > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/[email protected]/ > > To search via a non-Google archive, visit here: > http://www.mail-archive.com/[email protected]/ > > To unsubscribe from this group, send email to > [email protected] > -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
