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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.js cache problem

Status
Not open for further replies.

rhowes

IS-IT--Management
Joined
Jun 6, 2001
Messages
140
Location
ZA
Hi All

There are a few old threads on this problem but nothing that resolves it for me. I am hoping Kathy still reads this forum and found a solution.

It seems .js files are cached by the browser and not refreshed even if you clear temp files, control refresh etc.
I make changes to the .js files, and everything works well locally, but on the web the changes not not "active".

I am using IE 6.0. The server is Linux RedHat 7.2 with Apache 1.13.23.

This is a strange problem that has been on this list before. I have tried the "NO-CACHE" pragma and also setting expires on the Apache server.

Anyone had this issue and resolved it?

Thanks in advance.
Regards

Richard
 
I did not have your problem with IIS. What you could do is make the url to your js file allways unique like so:

<% Response.CacheControl = &quot;no-cache&quot; %>
<% Response.AddHeader &quot;Pragma&quot;, &quot;no-cache&quot; %>
<% Response.Expires = -1 %>
<script src=test.js?unique=<%=now()%>>
</script>
 
If your browser access the internet site via a firewall, the .js is probably cached by this proxy cache and you must wait for the expiration time of the proxy policy for renewing the content with your new .js version

This duration may raise up to several days.

Jean.rollet@agf.fr
 
rolletj is correct, I had this very same problem on a company intranet with js files
 
Hi All

It's a little more complicated than that. This is an extract from Microsoft's site:

SYMPTOMS
When Internet Explorer receives compressed files from a Web server, Internet Explorer saves some document types (for example, .js and .css files) in a compressed format. When the document is reloaded from the cache, the document cannot be loaded.

WORKAROUND
To work around this issue, the Web page author can set an expiration on .js and .css files to ensure that Internet Explorer loads them from the server every time they are requested.


Full link:
&quot;
So they identify the problem and give vague clues to a possible solution - GO MICRO$OFT!

Cheers
Richard
 
<script src=&quot;test.js?unique=<%=now()%>&quot;>

Doesn't this fix your problem??

IE should see the .js file as a different file everytime because the url pointing to the filename changes everytime.

for example
<script src=&quot;test.js?unique=06/07/2002 14:22:99&quot;


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top