Hi ooj,

unfortunatelly, iframes won't work with what we're doing right now. We
have several advertisement hacks up and running right now, using
iframes is one of them. Mostly we are calling the ads after the main
page and reposition them, but the special ad, I was called to help out
with, needs to be called as soon as possible since it's some kind of
preroll-video for the whole site. And worst of all, it comes bundled
with another advertisement. So even if I would say, what the hack, if
it overlays the whole document, why not let the user anyway, he has to
wait unessecary long for it to arrive, since another is coming with
it... ...

So I'm not sure either, whether or not it is even possible to call
remote scripts with jQuerys ajax()-function synchronously (with local
scripts you can for sure, even if everybody would tell you not to do
it). But the following code comes directly from jQuery-1.3.2.js and is
the called function to evaluate found scripts in the appending string.
And here the normal setup for ajax is async: false, exactly what I
would want, but what does not seem to work with remote scripts...

function evalScript( i, elem ) {
    if ( elem.src )
        jQuery.ajax({
            url: elem.src,
            async: false,
            dataType: "script"
        });
...

greetings

Benedikt

On 6 Aug., 14:16, Old Orange Juice <kc2...@gmail.com> wrote:
> I hate to be so web 1.0 but perhaps using iframe tags for now to load
> the ad's until the ajax problem is solved? My assumption was that ajax
> was always asyncronous.. hence the Asyncronus JAvasctipt Xml
> anacronism (have I got that right?). Didn't know you can do it
> syncronously as well.
>
> Is that something you perhaps set up in XMLHttpRequest object? Maybe
> Jquery can give you access to the request object and you can set
> fields that way.
>
> Taking a stab in the dark,
>
> ooj
>
> On Aug 5, 8:49 am, Benedikt <bplet...@googlemail.com> wrote:
>
> > Hi everybody,
>
> > hope I have your attention this time...
>
> > Some of you propably know the problem with advertisment distributors
> > and their excessive use of document.write()
>
> > On the one hand, you tried to call advertisement as soon as possible,
> > to have it shown as soon as possible. On the other hand, when you do
> > that, an the advertisement library calls another remote script, which
> > lags, your whole document lags. So you begin writing hacks to load
> > advertisement at the end of your document, and traversing it to the
> > positions, where it is to be shown. But your still bound to the
> > document loading, since you cannot allow document.write() to be called
> > afterwards...
>
> > So I didn't invent the wheel when I thought about rewriting
> > document.write()
>
> > One of these days I finally found an implementation of rewriting
> > document.write() which I actually got working:
>
> >         document.write = (function () {
> >             for (var i = 0; i < arguments.length; i++) {
> >                 $('#someId').append(arguments[i]);
> >             }
> >         });
>
> > And hey, there can come as many document.write() calls in any remote
> > script, which is called in scripts, which were called themselves via
> > document.write(), they are all append smoothly, without blocking any
> > of my page rendering. (I even have another little trick, with which
> > the whole advertisment calling is parallel to my page parsing)
>
> > I have found the holy grail, or didn't I?
>
> > Yes, as you propably already saw at first glance, I define the point
> > where to append inside my function definiton. So what the hack, just
> > rewrite as a closure, and before calling the nex ad change the id,
> > where it is to be appendend.
>
> > Unfortunatelly there is one big problem, I cannot get my fingers on.
> > jQuery's append() internally uses evalScript() to evaluate script-
> > tags, found in the appending-String. For script-tags with src-
> > attribute, it uses an ajax-call, with it's options set false for
> > async! But alas, it seems this is the point a cannot, for remote
> > scripts, jQuery's ajax()-calls always seem to be asynchronous.
>
> > So when calling an advertisement, then resetting the div,
> > document.write() should append to and then calling the seconf ad, I'm
> > not really synchronous any longer, the first written script-src are
> > still called, while the second ad starts calling it's own html-string-
> > with scripts. So when the first script-src is ready, an the script
> > inside is being evaluated, the new set position for document.write
> > already is set, and all is written to the latter.
>
> > Example (test.js and test2.js, vividly calling document.write()
> > themselves)
>
> > setIdDocumentWriteShouldAppendTo('#Id1');
> > document.write('<script src='http://remote.url/test.js'></script>);
> > setIdDocumentWriteShouldAppendTo('#Id2');
> > document.write('<script src='http://remote.url/test2.js'></script>);
>
> > the second document.write is called, before test.js is finished
> > loading...
>
> > There it is, your typical raise condition.
>
> > Hope any one can understand gebrabbel... ;)
>
> > greetings
>
> > Benedikt

Reply via email to