[Javascript] Caching the js files

DEV dev at qroute.net
Thu Mar 20 16:18:08 CST 2003


I am an ASP programmer. In ASP, one can use the Response.expires statement
to cache a page for the desired amount of minutes. For example
Response.expires=5 forces that page to be cached for 5 minutes. For the same
effect, we use Response.expires with a minus number to force the generated
pages that goes to the client to NOT to be cached.

Based on the above insight, what I thought of doing is the following;

Just refer to a JS file in the following way

<!--begin-->

    <script src='anASPpageThat_has_JS_code_in_it.asp'></script>
    The above JS file to be cached due to the ASP generated HTTP headers in
it

<!--end-->

As you see I refer to an ASP page instead of a JS one.
But I put the following code in that ASP page;


<%
'this area is ASP and server processes and replaces the code here with the
proper replacement
Response.expires=5 'cache the current page ( namely
'anASPpageThat_has_JS_code_in_it.asp' ) for 5 minutes.
%>


<script>
//blah blah
</script>

By using the above technique, I think I will be able to accomplish my goal.
Any comments ?


Also do you know ( if there is any ) the meta tag that one can use to set
the caching time ?

Thank you

----- Original Message -----
From: "BEKIM BACAJ" <trojani2000 at hotmail.com>
To: <javascript at LaTech.edu>
Sent: Thursday, March 20, 2003 11:00 AM
Subject: Re: [Javascript] Caching the js files


>
>
>
>
>
> As far as I remember, it's somehow connected with 1997-98 issue and has to
> do something with the *.HTML and *.HTM extension, I think saving your
files
> with *.HTML will hellp keep the visited page scripts and contents in
> internet temp folder longer than one session, if I recall correctly *.HTM
> was introduced somewhere at that period for fresh content of the revisited
> page and because of the '#' preceeding char in addresses used to prevent
the
> user to view the updated content etc.
>
> >From: "DEV" <dev at qroute.net>
> >Reply-To: javascript at LaTech.edu
> >To: <javascript at LaTech.edu>
> >Subject: [Javascript] Caching the js files
> >Date: Wed, 19 Mar 2003 15:29:18 -0800
> >
> >How do you cache a page where the caching of all the JS ( the <script
> >src='myFile.js'></script> ) files are cached only for that session ?
> >
> >_______________________________________________
> >Javascript mailing list
> >Javascript at LaTech.edu
> >https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
> _________________________________________________________________
> Tired of spam? Get advanced junk mail protection with MSN 8.
> http://join.msn.com/?page=features/junkmail
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript



More information about the Javascript mailing list