Howto Add a timeout to a javascript ad tag

Discussion in 'Javascript' started by Neil Sandow, Sep 20, 2003.

  1. Neil Sandow

    Neil Sandow Guest

    My site with servers located on the West Coast runs ads served by an
    adserver on the East Coast. A not infrequent problem occurs when a
    user on the West Coast tries to load a page but for whatever reason
    can't reach the adserver. It causes a portion or the entire page to
    hang until the request times out. This can take up to 30 seconds or
    more. Is there a way to set up a time frame which will drop the
    request or route it to a local default file under these circumstances?

    Here's an example of a current tag for a 468 x 60 banner:

    <!-- CODE FOR TOP BANNER -->
    <SCRIPT TYPE='text/javascript' LANGUAGE="JavaScript1.1"
    SRC="http://ads.mdchoice.com/RealMedia/ads/adstream_jx.cgi/www.rxlist.com/A%%ID%%@Top?topic=%%CAT%%"></SCRIPT>
    <SCRIPT TYPE='text/javascript' LANGUAGE="JavaScript"><!--_version=10;
    //--> </SCRIPT>
    <SCRIPT TYPE='text/javascript' LANGUAGE="JavaScript1.1">
    <!--_version=11; // --> </SCRIPT>
    <SCRIPT TYPE='text/javascript' LANGUAGE="JavaScript">
    <!--if (navigator.appVersion.indexOf('MSIE 3')>
    -1){document.write('<IFRAME WIDTH=468 HEIGHT=60 MARGINWIDTH=0
    MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no
    BORDERCOLOR="#000000"
    SRC="http://ads.mdchoice.com/RealMedia/ads/adstream_sx.cgi/www.rxlist.com/A%%ID%%@Top?topic=%%CAT%%"></iframe>');}
    else if (_version < 11) {document.write ('<A
    HREF="http://ads.mdchoice.com/RealMedia/ads/click_nx.cgi/www.rxlist.com/A%%ID%%@Top?topic=%%CAT%%">');document.write
    ('<img alt="
    SRC="http://ads.mdchoice.com/RealMedia/ads/adstream_nx.cgi/www.rxlist.com/A%%ID%%@Top?topic=%%CAT%%"
    border=0 WIDTH=468 HEIGHT=60></a>');}// --></SCRIPT>


    Thanks! -Neil
    Neil Sandow, Sep 20, 2003
    #1
    1. Advertising

  2. Neil Sandow

    Ivo Guest

    Looks like your page doesn't need any of the code you posted. If so, why not
    remove all of this, and tell the page in one line of script to load the ad
    scripts after it has finished loading.
    Or remove the urls from the code, and set them dynamically onload.

    "Neil Sandow" <> wrote in message
    news:pINab.353$...
    > user on the West Coast tries to load a page but for whatever reason
    > can't reach the adserver. It causes a portion or the entire page to
    > hang until the request times out. This can take up to 30 seconds or
    > more. Is there a way to set up a time frame which will drop the
    > request or route it to a local default file under these circumstances?
    >
    > Here's an example of a current tag for a 468 x 60 banner:
    >
    > <!-- CODE FOR TOP BANNER -->
    > <SCRIPT TYPE='text/javascript' LANGUAGE="JavaScript1.1"
    >

    SRC="http://ads.mdchoice.com/RealMedia/ads/adstream_jx.cgi/www.rxlist.com/A%
    %ID%%@Top?topic=%%CAT%%"></SCRIPT>
    > <SCRIPT TYPE='text/javascript' LANGUAGE="JavaScript"><!--_version=10;
    > //--> </SCRIPT>
    > <SCRIPT TYPE='text/javascript' LANGUAGE="JavaScript1.1">
    > <!--_version=11; // --> </SCRIPT>
    > <SCRIPT TYPE='text/javascript' LANGUAGE="JavaScript">
    > <!--if (navigator.appVersion.indexOf('MSIE 3')>
    > -1){document.write('<IFRAME WIDTH=468 HEIGHT=60 MARGINWIDTH=0
    > MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no
    > BORDERCOLOR="#000000"
    >

    SRC="http://ads.mdchoice.com/RealMedia/ads/adstream_sx.cgi/www.rxlist.com/A%
    %ID%%@Top?topic=%%CAT%%"></iframe>');}
    > else if (_version < 11) {document.write ('<A
    >

    HREF="http://ads.mdchoice.com/RealMedia/ads/click_nx.cgi/www.rxlist.com/A%%I
    D%%@Top?topic=%%CAT%%">');document.write
    > ('<img alt="
    >

    SRC="http://ads.mdchoice.com/RealMedia/ads/adstream_nx.cgi/www.rxlist.com/A%
    %ID%%@Top?topic=%%CAT%%"
    > border=0 WIDTH=468 HEIGHT=60></a>');}// --></SCRIPT>
    >
    >
    > Thanks! -Neil
    >
    Ivo, Sep 21, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. shruds
    Replies:
    1
    Views:
    779
    John C. Bollinger
    Jan 27, 2006
  2. tranky
    Replies:
    2
    Views:
    426
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Aug 29, 2006
  3. Mark Probert

    Timeout::timeout and Socket timeout

    Mark Probert, Oct 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    1,279
    Brian Candler
    Oct 6, 2004
  4. Neil Sandow

    Add a timeout to javascript ad tags

    Neil Sandow, Sep 20, 2003, in forum: Javascript
    Replies:
    0
    Views:
    105
    Neil Sandow
    Sep 20, 2003
  5. Neil Sandow

    How to add a timeout to a javascript ad tag

    Neil Sandow, Sep 20, 2003, in forum: Javascript
    Replies:
    1
    Views:
    111
Loading...

Share This Page