Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Thanked 0 Times in 0 Posts

    Delay external script

    Hi everyone! I'm new to the site and could use a little help. Here's the issue:

    I have a script i'm including on my page but I'm concerned with the time it may take to download. This script calls an ad server which can serve up any number of objects (image, flash, more javascript). Sometimes this can take a few seconds to download and the page doesn't render anything until thats complete. Here's kinda what I'm doing...

    <script type="text/javascript" src="http://myadserver" id="SlowBannerAd" />

    <!--All my wonderful content-->

    What I'd like to do is somehow delay this event from happening until the rest of the page has rendered. Any ideas? Thanks!

  2. #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    In a place far, far away...
    Thanked 1,043 Times in 1,019 Posts
    You have a few options. Putting the script tags towards the bottom of your document before the closing </body> tag though some browsers load differently. Another option would be to use setTimeout to append the javascript to the document dynamically using the DOM. The DOM is a little more work but not much.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts