Closed Thread Icon

Preserved Topic: Handling Preloading Pages that link to <a href="https://ozoneasylum.com/backlink?for=18265" title="Pages that link to Preserved Topic: Handling Preloading" rel="nofollow" >Preserved Topic: Handling Preloading\

 
Author Thread
DangBat
Nervous Wreck (II) Inmate

From:
Insane since: Sep 2000

posted posted 07-08-2002 06:06

OK, here is the situation. We all know how ImageReady sets up rollovers, with preloading the images at the body onLoad. If that function isn't executed, then rollovers don't work.

Here is the problem, though. I have recently learned that ZoneAlarm, when setup to block ads, will remove the onLoad property of the BODY tag. Thus, no preloading, hence rollover, uh... therefore no fun? Now, I know that I can add a simple script tag at the very end with preloadImages(); but I was wondering what method did everyone else use to circumvent ad blocking.

So, basically, if you had no onLoad, how do you get your scripts running?

Peace.

-D

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 07-08-2002 15:24

Um.

Anyone who wrote ad-blocking software that removes the onload event of the body tag is an idiot. There are much more elegant ways of removing ads, such as causing the browser to ignore the window.open method.

If it's stupid enough, you may be able to say, in your script,

onload = myfunction;

instead of using the HTML onload="" of the body tag.

There's no real way around that except an obvious workaround like adding it in a script tag at the end of the document or something.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 07-08-2002 18:15

I prefer using the body onload method, it's just more elegant and helps the content load faster but you don't necessarily need to do it that way, you can just call the function at the bottom of your script. But then all the images need to load 3 times before the user gets the page. Depends on how graphic intensive your page is, if it's relatively light then the user won't notice much of a diff.

That is a stupid way to work removing the onload handler it doesn't prevent squat.



.:[ Never resist a perfect moment ]:.

Hugh
Paranoid (IV) Inmate

From: Dublin, Ireland
Insane since: Jul 2000

posted posted 07-08-2002 18:52

Another option would be to put the following after the Preloader function:

var loaded=false;

function preloadimages() {
if(!loaded)return false;
....
....
....
}

setTimeout("loaded=true;preloadimages();",2000);

This will be the same as bitdamaged mentioned but it will give 2 seconds for the preloading to start, so if it takes less than 2 seconds for your content to load, this will have the same effect as having in the body onload.

This adsoftware you speak of would disable any of my sites from working at all, thats nice to know.

DangBat
Nervous Wreck (II) Inmate

From:
Insane since: Sep 2000

posted posted 07-08-2002 22:02

Well, in case this comes as a surprise, ZoneAlarm is an extremely popular firewall software, which has, among it's features, the option to block ads (in the Pro version), and if set to block pop-up/pop-under, one of the things removed from the page is the onLoad property.

In trying to see if ZoneAlarm had plans for removing this, I found out that other programs, such as Proxomitron do the same, and, well, who knows how many more?

Anyway, as I said, it's a pretty popular program, especially among geeks. I'm surprised no one here has heard of it. Worst case scenario is that a bunch of your users aren't seeing your pages as they should.

As far as my own problem, I find that Slime's solution is the easiest and plain best. I just put a window.onload = preloadImages(); and was done with it. It circumvented ZoneAlarm's ad blocking. A timer would have been odd, considering that broadband users would have loaded the page in about a second, while dialups take, well, a bit longer.

Thanks

-D

lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 07-15-2002 08:36

Hugh, it is better not to use a loaded flag, instead set the timer as:


myTimer = setTimeout("preLoad();", 2000);

then inside the preLoad() itself kill the timer after it does its job as:

clearTimeout(myTimer);

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 07-15-2002 13:24

First of all, you don't need clearTimeout once the Timeout has happened. You only need that with setInterval. setTimeout will only execute the code once, and then loses its effect.

Second, that isn't a better method. In fact, it could cause a javascript error on a machine with a slow internet connection. If parts of the page haven't loaded after two seconds, and the preLoad function tries to access those parts of the page, there would be an error.

lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 07-15-2002 14:25

yes slime right, i forgot!

« BackwardsOnwards »

Show Forum Drop Down Menu