Log in

View Full Version : Slow loading script problem.


neverstop
11-21-2007, 02:56 AM
Hi,

I have a script from an advertiser that produces a geo-targetted text link. The problem is the script is slow to load which delays loading the rest of my site, as this code is placed in the header. Is there some way I can have the script load last, but still have it show in the header?

Here is the relevant code from the advertiser.

<script src="http://banners.adultfriendfinder.com/piclist?message=5&amp;p=text_links&amp;pid=p174798&amp;rand=4&amp; target=_blank&amp;site=ffadult&amp;this_page=banners_text_ links"></script>

Cheers,
Ian

UK Jimbo
11-21-2007, 11:28 AM
Try:

<script src="http://banners.adultfriendfinder.com/piclist?message=5&amp;p=text_links&amp;pid=p174798&amp;rand=4&amp; target=_blank&amp;site=ffadult&amp;this_page=banners_text_ links" defer></script>

the defer tag should make the browser handle it after the page has been rendered

neverstop
11-22-2007, 04:57 AM
Hi,

Apparently the defer attribute does not work in firefox.

I am hoping to find a solution using css position maybe? or javascript even?

Cheers

Analogpoint
11-22-2007, 03:23 PM
Put this where you want the ads:
<div id="adsplaceholder"> </div>

Put this at the very bottom of the footer.
<div id="myads"><script src="http://banners.adultfriendfinder.com/piclist?message=5&amp;p=text_links&amp;pid=p174798&amp;rand=4&amp; target=_blank&amp;site=ffadult&amp;this_page=banners_text_ links"></script></div>
<script type="text/javascript">
var adtarget = document.getElementById('adsplaceholder');
var ads = document.getElementById('myads');
adtarget.appendChild(myads);
</script>

neverstop
11-22-2007, 06:50 PM
Hi,

After making those edits, nothing shows up where the adsplaceholder div is, and the myads div shows at the very bottom of the footer...

Analogpoint
11-22-2007, 07:57 PM
Hmmm, I just did a test and it worked for me.

neverstop
11-22-2007, 09:21 PM
Any ideas what I could be doing wrong? These edits seem pretty simple...

So just to be clear I added the adsplaceholder div in my header, with nothing between the div tags. And added the myads div + the javascript in my footer. The ad shows where the myads div is placed, and nothing shows up where the adsplaceholder div is...

Analogpoint
11-22-2007, 09:34 PM
Ok, I just tested it again.

I added this to the very bottom of the navbar template
<div id="adsplaceholder"></div>

And the following to the very bottom of the footer template
<div id="myads"><script src="http://banners.adultfriendfinder.com/piclist?message=5&amp;p=text_links&amp;pid=p174798&amp;rand=4&amp; target=_blank&amp;site=ffadult&amp;this_page=banners_text_ links"></script></div>
<script type="text/javascript">
var my_ads = document.getElementById('myads');
document.getElementById('adsplaceholder').appendCh ild(my_ads);
</script>
Try that.

neverstop
11-22-2007, 09:42 PM
Yup that worked! Sure beats using a ghetto transparent iframe.!

Thanks alot!