I need to quit firefox and restart it in order for the applet to be refreshed... its anoying since i'm still programming it an the class files changes... am i missing some codes which makes it unable to refresh the applet and still take the one from the cache???
So I have a .jar applet in my website, a simulation game that spawns army whenever user clicks on the screen... however whenever I refresh the page, the previous army are still there on the screen.. I want it to be refreshed (as if we're jus开发者_如何学Got starting to run the application the first time).
I already tried pressing CTRL+f5 but the trick doesn't seem to work
I'd basically like to do it automatically using scripts or something, so that it won't require user to manually press some button on the keyboard
Any Suggestions?
I'd really appreciate it
Thank you....
You are aware of the appletviewer program in the JDK?
Have you tried to prevent caching?
Pragma:no-cache Cache-Control:no-cache Expires:-1
Try clearing the cache by Pressing Strg + Shift + Entf
and then reloading the Page.
Some understanding of the Applet lifecycle may help here.
init() is automatically called when the Applet is first loaded. This event only happens once. start()
is always called just after init()
start() is automatically called whenever the user loads a page that hosts the applet.
stop() is automatically called whenever the user leaves a page that hosts the applet.
destroy() is automatically called when the applet is removed from memory. This event only happens once. stop()
is always called just before destroy()
.
As you can tell from the description of the start()
and stop()
methods, the applet isn't unloaded as soon as you leave a page. I'll be honest, I'm not certain exactly when it's unloaded.
However, you could put some code in the Applet's stop()
method that removes any armies that you added, or do some trickery in the start()
method to reset the game data.
精彩评论