[thelist] NN4.7 not showing my Home page/images

Keith Davis cache at dowebs.com
Sun May 27 16:50:37 CDT 2001


NN 4.7 the display seems ok to me, so I assume that the image problem is
fixed. 

BUT, the first time on the page I got javascript errors. Subsequent
reloads got no errors. I notice you have an onload in the body that
calls a function presumably in the external js. On the first load the js
file is not completely loaded, producing the error. But by the time a
subsequent page load is done the js file has been cached and is pulled
from the cache so no errors. Common problem, Easy to fix.

I apologize, I left out an important detail earlier about external js
files. Although you have it in the head and it theoretically should have
loaded by the time the onload event is triggered, that does not
necessarily happen. There is nothing directly forcing that js file to
actually load and get compiled by the script engine prior to the page
triggering the onload event. Whether the js load beats the onload event
is dependent on net traffic, if the script tag is in the head section.
The body onload event referres only to the body loading, not the page.
There are also onload events for each image.

Solution. Place the external js tag in the body section, the first thing
in the body section. If you load a really immense js file from a tag in
the body you will notice that the page pauses its display at that point
until the js file has fully arrived in the browser. That's by design
since an external js could contain document.writes that affect the page
layout. It also guarentees that your js file has arrived and been
examined by the HTML engine for document.writes before the onload event
triggers.

It still takes time to compile and register the script in the script
engine. So on small pages with large js files it's sometimes necessary
to insert a half second setTimeout. But on your page that will not be
necessary. Also, since an external js tag in the page causes a pause in
page display it slows down reduring the page, not a good deal. So, one
should split up a large js file, if possible, placing only the onload
functions and any associated variables and/or any doc.writes in the
body, and all other functions and variables in the head.

Hey, I like it, that is 24 carat design!

keith




More information about the thelist mailing list