A banner javascript slows down my site - suggestions?
I have a script for rotating banners on my page. A company sells banners on pages that join their advertising system. I put their code on my page and now it is slowing it down because the whole page waits for the banner to load before it shows the rest of the contents of my page.
I am a complete newbie when it comes to scripts but I remember seeing a script for roll over images that preloaded all the images so that when someone went over the pic with their mouse, a roll over image immediately appeared.
This made me think that if there is a preload function, there must also be a postload? function. A function that tells the script to only start working after the rest of the page has been shown.
I'm sure this sounds stupid but I don't know any other way to describe it. Any help or advice where to look for a solution to this problem would be greatly appreciated.
You must have a tables based web page, that makes it easy for advertisers to ensure your page won't display until their advertisement is ready for display with the page. If you want to fix this without performing major surgery on your web page the best thing you can do is to adjust your web page so the code for the advertisement is totally outside any <table></table> tags.
I would also contact the advertiser and demand they upgrade their servers or their link to the web, being slow is not excusable. You might want to double-check whatever contract you have with them to see if there are any "performance" clauses you can directly demand they live up to.
__________________
Check out the Forum Search. It's the short path to getting great results from this forum.
My first action was to e-mail them and ask them why their script slows down my page. They didn't reply so I was forced to find an answer elsewhere.
Roy, I tried putting the banner outside any tables and it did help with loading my page better. Thanks a lot. However, I would still like to find a better solution which would allow me to put banners into tables as well since I would like to put them on my forum which gets most of the traffic. Anyone have an idea how to do this?
One dirty little secret about tables is that the browser has difficulty deciding how wide cells have to be and how tall they have to be until it has the full content of the cell available. The newer browsers try their best to render as much of the page as they can and will go back and readjust the page to fit if they have to but there are simple techniques to ensure that the content of the table isn't rendered until it's all available and when the table is pretty much your whole page (ie a table based layout) then just one element not yet received can hold up the rendering of the whole page (which is what you're experiencing). Advertisers are very aware of that and will make sure their content falls into that category because they want to make sure that a sufer hitting a page with their ad on it doesn't find a link to the next page until they've seen the ad.
__________________
Check out the Forum Search. It's the short path to getting great results from this forum.
__________________
"God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "
Jamescover's idea works great, I haven't tried the other one yet. The only problem remains if the banner is a resizable one that folds down when you go over with your mouse but I can live with that. You guys are great, thank you for all the help and in such a short time period.
__________________
"God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "
I tried all the suggested ideas and the one with the iframe worked best. However, there is a problem when I try to put two iframes in one page (header and footer). For an unknown reason, only one loads up with the script while the other one remains empty. Is there a way to put two iframes in one page so that both work?