Feedback on: irt.org FAQ Knowledge Base Q565
Worth:
Very worth reading
Comments:
Hello,
I tried the solution to question 565 (how to prevent the caching of *.js files). However it does not work! I deleted all files in the cache and then tested your solution. However, there still shows up a file ***.js in the cache!
I am not sure if it is actually possible to prevent netscape form caching files via javascript!
Comments:
that answer is essentially how
cache busting works for ad servers,
etc.
but what i'd generally want is for js files to
be treated like any other file --
which means the browser should send
a HEAD request to determine
if it has changed.
i guess the question is whether
the browser does that. i don't
think IE did the right thing with
checking modification of img src's
until IE5, so i wouldn't be surprised
if it did the wrong thing with script.
any idea how it behaves?
(and any idea why this comment window is only 30 characters wide?)
Worth:
Very worth reading
Comments:
I have tried everything I can think of but I can't get it to work. I either get a message saying the object is not supported or I just get a blank screen.
I really need this function, have you come up with anything new on it?
Worth:
Very worth reading
Comments:
I think I've found a solution (at least it works on the browsers I've been able to test => Netscape 4 and IE 5). Another post came close, but had some case typos. It is important to get the case on the getTime() function EXACTLY right. Also, make sure the rest of your JavaScript is contained in a separate <script> block. Here it is...
<script language="JavaScript"></script>
Worth:
Very worth reading
Comments:
Let's try this again since the last post didn't come through properly. The following should go in the <scipt> block...
document.write('<script language="JavaScript" src="include.js?'+(new Date).getTime()+'"><'+'/script>');