Caching if js Files

D

Dole

We have a problem with caching of js Files in our application.

The situation is that in some location our application is not running
well - the problem we identified was that not the actual js is used in
these problem locations.

We are using jsp and external javascript files. We have configured our
webserver to insert into the http header cach-control and pragma -
both parameters with no header.
My problem is now that in we identified that the changes we made in
the javascript are not directly displayed and used in the application.
Also when the user is deleting the cache in the browser the wrong
javascript is use to display the page.
We also tried to download the js file directly from our webserver and
then the correct js file was donwloaded.

So my assumption is that either the proxies of our customer are not
able to understand the http header we insert into our information we
sent to them or our webserver is not well configured and we are not
forcing the application to update existing js files in the customer's
proxies.

Does anybody has any idea what we should test? Or which parameters can
help us to solve the problem with the not loaded js files?

Thanks for help

Dole
 
G

Grant Wagner

Dole said:
We have a problem with caching of js Files in our application.

The situation is that in some location our application is not running
well - the problem we identified was that not the actual js is used in
these problem locations.

We are using jsp and external javascript files. We have configured our
webserver to insert into the http header cach-control and pragma -
both parameters with no header.
My problem is now that in we identified that the changes we made in
the javascript are not directly displayed and used in the application.
Also when the user is deleting the cache in the browser the wrong
javascript is use to display the page.
We also tried to download the js file directly from our webserver and
then the correct js file was donwloaded.

So my assumption is that either the proxies of our customer are not
able to understand the http header we insert into our information we
sent to them or our webserver is not well configured and we are not
forcing the application to update existing js files in the customer's
proxies.

Does anybody has any idea what we should test? Or which parameters can
help us to solve the problem with the not loaded js files?

Thanks for help

Dole

To ensure the browser requests a new copy of your external client-side
JavaScript files when they change, use a versioning system on the URL.
Something like:

<script type="text/javascript"
src="ourClientSideJS.js?v=200307111200"></script>

When you change the file at 9am on August 17, 2003, you'd change this to:

<script type="text/javascript"
src="ourClientSideJS.js?v=200308170900"></script>

When the browser sees this new URL, it will determine is has not cached a
copy of it and download a fresh copy from the server.

If you need to use the same client-side file in multiple places, rather
then change the value of "v" everywhere, put the <script ...></script> tag
in a server-side include and #include it on every page you use it on, then
you only need change the value of "v" in one place when the contents of
ourClientSideJS.js changes.

--
| Grant Wagner <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-developer/upgrade_2.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,211
Latest member
NelleWilde

Latest Threads

Top