Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cache: .js - yes , .asp - no

Status
Not open for further replies.

weatherwax

Programmer
Jan 13, 2001
4
AT
I know how to prevent my html from being cached.
But I would like my javascript-file I included to stay cached.

So my question is: do you know a way that a .js file - that is used on several pages - stays in the clients cache and is not reloaded everytime the user visits this pages.

my no-cache commands:
Response.AddHeader "cache-control", "private"
Response.CacheControl = False
Response.AddHeader "pragma", "no-cache"
Response.ExpiresAbsolute = #January 1, 1990 00:00:01#
Response.Expires=0

the js file is included with <!--#include file=&quot;myfile.js&quot;-->

thank you

weatherwax


 
if you include it like this:

<script src=&quot;myfile.js&quot;></script>

it should get cached. adam@aauser.com
 
I tried your approach, but alas it didn't work.
the .js is reloaded.

Thanks

weatherwax
 
that should work. you might want to check your cache settings in your browser... as there is no way to force someone to cache a file if they dont want to. adam@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top