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

Keith Davis cache at dowebs.com
Tue May 29 00:56:52 CDT 2001


sfmalo wrote:
> 
> Mmmmm. So you are suggesting doing away with the remote JS file altogether
> and placing the full script in the body of each page?

Mmmm. No I didn't suggest that. But you're right. That would be most
ideal I think. No pause waiting to call the script as a separate
resource plus guaranteeing that the full text script is compiled and
waiting to work when the page onload happens. 

> Have to chuckle about all this as my first line of text on the Home page
> says in effect, "try my services because of, among other reasons,
> fast-loading pages ..." Yikes.

I get your point. But, you do not need to abandon the external js
altogether. You can put the full text script in the body of the home
page as you suggested above. AND, you can put the external js tag in the
head of the home page too. Then when the visitor moves to another page
the external js file will already be cached and will be called almost
instantly from the cache. And on those other pages you can put it in the
head section also. Will there be a conflict on the home page with two
identical sets of scripts. I honestly don't know. I think that there
would not, but when I've done this in the past I've used the cautious
approach - I've renamed all the functions and variables, and arrays in
the full text copy and then changed the onload function call on that
page and all references to the array and variables in those functions. I
just add an underscore to each name ( _clic() ). That way there are two
totally different sets of scripts.
> 
> Another thought. Could my js script in the body for the status bar be
> interfering in some way? If I decide to put the full script in the body, I
> could place it first, then the status bar script would follow. Or, get rid
> of the status bar script altogether?

There should be no conflict. I'd place the rollover script within the
same script tag block. You can mix match all you want.

> As a note of interest, when I originally uploaded the site Saturday, I had
> two applets on the home page (one an invisible counter and the other a news
> ticker). Well, the fight was on! I watched the status bar as the two applets
> called their respective sites and ate up valuable seconds loading before the
> nav images did. I moved the news ticker to another page which helped. BUT,
> still when I'm on another page and click to return to the Home page, the
> counter applet ends up being called again before I'm allowed back on home.
> Again, not fast navigation but I do want the counter there so guess I'm
> stuck with that.

Java Applets present a slightly worse problem that external js files
placed in the body. In both instances the browser will freeze all other
rendering to figure out if and how those external files will effect
layout. The additional problem with a java applet is that it caches
differently. The java virtual machine has to be invoked anew each time
the page is accessed and the applet has to be recompiled and assembled
each time. And unlike an external js file, an applet is assumed to be a
non-static resource so the browser checks with the server to see if a
new copy should be downloaded. But you can minimize the effect. Place
the applet as the last thing on the page and it wont effect anything
other than the triggering of the onload event. The best thing would be
to change to a php or ssi counter as they will be executed before the
page leaves the server.
> 
> By the way, how can you read my remote JS file? I thought it was safely
> tucked away in my host's root directory! Glad you are for the help you're
> giving me, but how can it be?

Gotcha. I could have easily viewed your document source to find the URL
to the js file, then placed that URL in IE5's location and called the
file. IE will then prompt to download it as an "unrecognized file type".
But I have a homemade Perl LWP::UserAgent (virtual browser) running in
the background on my localhost development environment. In just a few
keystrokes I asked it to scan your home page for ".js", parse the URL
and get_store() your js file to my hard drive. I could copy all "world"
readable resources off your domain in seconds. You can't hide anything
on your server that can be called to a browser by an HTML tag. That
includes JavaScript files and Java Applets - LWP slurps them up like
M&Ms. And with a little more work IE can snack on them too.

keith




More information about the thelist mailing list