Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-17-2007, 09:48 PM   PM User | #1
Flenorl32
New to the CF scene

 
Join Date: Jun 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Flenorl32 is an unknown quantity at this point
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...

<html>
<!--Header-->
<!--BreadCrumb-->
<script type="text/javascript" src="http://myadserver" id="SlowBannerAd" />

<!--All my wonderful content-->
</html>

What I'd like to do is somehow delay this event from happening until the rest of the page has rendered. Any ideas? Thanks!
Flenorl32 is offline   Reply With Quote
Old 06-18-2007, 12:04 AM   PM User | #2
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
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.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:08 PM.


Advertisement
Log in to turn off these ads.