开发者

how to remove old applet from browser's cache programmatically?

开发者 https://www.devze.com 2023-04-12 11:00 出处:网络
Is there a way to delete older version of an applet from browser\'s cache? The things I have already tried to prevent the cache problem in first place are:

Is there a way to delete older version of an applet from browser's cache? The things I have already tried to prevent the cache problem in first place are:

1- To set "no-cache" in HTTP response header, I placed following script on the top of my jsp:

<% 
if (request.getProtocol().compareTo("HTTP/1.0") == 0) {
            response.setHeader("Pragma", "no-cache");
        } else if (request.getProtocol().compareTo("HTTP/1.1") == 0) {
            response.setHeader("Cache-Cont开发者_JAVA技巧rol", "no-cache");
        }
        response.setDateHeader("Expires", 0);
%>

2- While deploying applet 'cache_option' is set to 'no'

But of no use. I was now wondering if there is a way to programatically delete this applet jar file from cache?

[UPDATE]

Providing a unique url for applet each time doesn't look like a good idea in my case. As, in my case applet reloads(refresh) itself after a time (say at mid-night, using Timer), hitting on a url

applet.getAppletContext().showDocument(url); 

It would be difficult to communicate new url to applet


The answer you got on your other question also applies here: Provide a unique url for your applet each time. It's not humor, as lots of people are using this technique and it would solve your problem.


these links might be of your help:

Applet Caching and Installation in Java Plug-in

how-to-clear-cache-to-reload-applet

How to disable http caching in applet

How to disable browser applet cache..?

Java applet cached forever, not downloading new version?

There are a couple of solutions to your problem. The one which is discussed more in the links, is to use a different name for every applet jar file. Append version number or anything so as to ensure that browser loads the applet from the server every time it runs, rather then from the cache. You can get more help from the above pasted links. Thanks.

P.S. The links are pasted in order of relevance.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号