I've solve this problem with document.write redefine, it's not simple solution, coz you need to control script loading, but in common was like this: redefine document.write, parse content for each dw call, find content and scripts inside put content to placeholder, async. load scripts that was found (that scripts could use dw too, so you need to redefine dw again; i've worked with doubleclick banners and sometime there was 3 scripts inside each other who called dw); this solution easy when you have 1 banner, when you have 2 and more you basically need to load all scripts by yourself and execute in needed document.write context for exactly banner placeholder, this means global redefined document.write became a proxy for all scripts and placeholders, this require more complicated "architecture" implementation. I've solve multiple banners loading with simple "text" events (basically simple observer).
Erik, I hope this flow of thoughts could help you somehow :) All, interesting to hear if anyone used solution like this Regards, Anton. On Dec 15, 2010, at 11:31 PM, Ben Alman wrote: > I wrote a small jQuery plugin to do this, but I didn't get to spend enough > time on it to know if and when it will fail. It doesn't use Iframes, but does > override document.write and document.writeln, and in my testing, worked with > nested scripts. It's obviously not the most robust solution out there, since > it doesn't use Iframes to sandbox. > > http://benalman.com/projects/jquery-misc-plugins/#loadadscript > > - Ben > > "Cowboy" Ben Alman > http://benalman.com/ > RJ3 Productions > Broken Buddha Records > > > On Wed, Dec 15, 2010 at 2:29 PM, Balázs Galambosi <[email protected]> > wrote: > 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] > > > -- > 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]
