First, I'd recommend renaming it with a ".js" file extension, since JSP is probably 
misleading if it's only got JS functions.

I don't see where you could (forcibly) "cache" it on the client machine, nor would you 
want to.

Most modern browsers try to cache files (I know HTML and images, and I'm assuming .js 
files as well), so this might already be done for you by most clients.  Unless this is 
a huge .js file, and most/all of your clients are over a dial-up connection, I 
wouldn't worry about it too much.

But, for performance and modularity, it's generally best to create a single "main.js" 
for common/shared javascript functionality, and a page- or use-case-specific 
javascript file in addition depending on the page.  (You can, of course, embed as many 
as you like.)


-----Original Message-----
From: Joao Batistella [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 16, 2004 2:32 PM
To: 'Struts Users Mailing List'
Subject: The browser cache JS resources?


Hello.

I have a doubt. I'm thinking about including in all my pages the same
javascrip file with the code:
<script language="Javascript1.1"
src="js/staticJavascript.jsp"/></script>

This is because I want this file with all javascript code (or including
code) in all pages, even the page doesn't make use of it.

Is this bad? My doubt is if the browser will always request the JS file,
every request or put it in cache.

Thanks,
JP
        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to