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

Problem: caching of .js files 1

Status
Not open for further replies.

dbrom

Programmer
Feb 21, 2001
100
US
Hey everyone!

On my pages, I have set up a banner rotator that contains, for instance, Image objects with their .src properties pointing to image files and stuff like that.

However, when I change the content of the .js file, the page into which it is included via <script src=*.js> does not show any changes. I understand that .js files are cached in the browser, but it does not change even after I manually delete temp. internet files and clear history and close all browser windows...

SO my question is:
Is there any way I can get around this thing without putting all javascript code in the html files, since I may have a lot of the files using banner rotation...

Note: files are at iChat.com, and for some reason I cannot use <!--#include--> thing on their server. It would be a great alternative to using .js files, though, but it does not work...

Thanks in advance.
Dmitriy. <Dmitriy>
dbrom@crosswinds.net
 
hi
i had the very similar problem, & i did just everything you've described here: deleted temporary, cleared history, changed my browser settings to check for newer versions of stored pages to allways & i don't know what did the trick (but i guess it is last one; so, try it), but it works now pretty good

and btw, here is what i use to prevent my scripts from caching on users machines:

<script language=&quot;javascript&quot;>
var time_now=new Date();
var secs=time_now.getSeconds()
document.write(&quot;<script language=\&quot;javascript\&quot; src=\&quot;scripptt.js&quot;+&quot;?time=&quot;+secs+&quot;\&quot;>&quot;+&quot;</&quot;+&quot;script>&quot;)
</script>

& looks like it works..

Victor
 
Thanks buddy!

It does work the way you suggested.
I appreciate the quick answer.

Dmitriy. <Dmitriy>
dbrom@crosswinds.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top