Question

How can I make the browser of a client load the new version of the html page with a new java applet?

We updated a system in the field, but when the client connected to the web server, the old java applet was still shown (from the cache).

How can I force (preferably from the server side) the client to load the new version instead of the one from it's cache?

Old system (before upgrade) :

  • old linux version (more than 10 years old)
  • old apache webserver (more than 10 years old)
  • old java applet (separate class files) (about 2 years old)
  • old index.html in webserver root dir (about 2 years old)

New system (after upgrade) :

  • same IP address and port as the old system
  • windows xp embedded
  • apache/2.2.21 (win32) webserver
  • new java applet in jar file (all different class names from the old version)
  • new index.html in webserver root dir

The user is using Chrome on a Windows XP machine

When the user loaded the page in Firefox, the new java applet was shown and working flawlessly. (He never loaded the old java applet in firefox)

[EDIT]

adding the lines from looper to my httpd.conf did not lead to any errors, but i am not sure if it works either ...

i don't seem to be able to reproduce the caching problem of my client : when i change something the in the applet and load it again from another computer, then nothing changes, but when i reload a few minutes later, it does show the new version .. without or without those extra lines with CacheDisable

when i search my httpd.conf for "cache" then all i find is :

#LoadModule cache_module modules/mod_cache.so
#LoadModule disk_cache_module modules/mod_disk_cache.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule mem_cache_module modules/mod_mem_cache.so

so it seems no caching is enabled ?

when i add the line with CacheDisable by itself (without IfModule), then Apache doesn't want to start, so it probably corrupts httpd.conf ?

[EDIT2]

as the server OS, web server, java class names, and all filenames except index.html are different from the old version, it must be the cached index.html which is the cause of the problem. I added the meta tags from FrancescoMM's answer to my index.html, and hope this will prevent the problem for future releases

Was it helpful?

Solution

If the java classes are different, then the index file is the one that is in cache. It could also be the client proxy cache, so acting on the server has no result.

The fastest solution is to send a new url to the client:

http://www.site.com/index.html?random_param=1234
http://www.site.com/?random=1234
http://www.site.com/?1234
http://www.site.com/?new

or even just

http://www.site.com/?

should be enough.

EDIT

Also, have you tried adding all the pragma no cache and expiration date meta tags to the HTML page? That should tell the client proxy to reload the page anyway.

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2002 11:12:01 GMT">

Note that EXPIRES is set to an old date on purpose. This may not solve your problem this time, as if the new index is not loaded, nobody (server, proxy, client) will see the new tags, but will make sure the next time the page is loaded every time.

OTHER TIPS

Unless you put functionality that allows the applet to invalidate itself based on a server instruction, you'll have to do reset from the client side. Clearing the cache on the browser should do, from the information provided. Every browser has a way of clearing its cache. I don't believe there's a shorter way than that.

Every system turns into a legacy system the moment it's first deployed. It's always a good idea to plan for upgrade. At the very least, any applet that does server communication should report its version number to the server, enabling the server to reject service, start upgrade, notify the user, or whatever else is appropriate.

Just force no-cache in Apache in the httpd.conf.

From the apache-docs:

<IfModule mod_cache.c>
    CacheDisable /local_files
</IfModule> 

Instead of disabling cache for all local files, you can specify the complete path to the applet-file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top