Firefox kills Java applets when out of view

Hiding a Java applet using display: none causes firefox to kill the applet until it is visible again. It also seems to kill the applet if you position the applet out of view ie. position: absolute; left: -9999; Using visibility: hidden; will hide the applet without killing it, but then the applet still takes up space in the layout which doesn't work for my application. Does anyone know of a workaround to prevent firefox from killing java applets when they're hidden via display or a negative position offset??

The usage is a java upload applet that I'd like to hide during an upload without killing the upload.

13.10.2009 22:44:36
2 ОТВЕТА
РЕШЕНИЕ

The behaviour of applets while hidden is entirely browser-specific. Safari 4, for example, calls stop() when the user changes to a different tab and then start() when changing back to the applet tab (at least on mac it does, not sure about windows).

Rather than use position hacks, set the applet to a 1x1 pixel size. That leaves a white dot on the screen but is the only really cross-browser way to guarantee the applet stays active.

5
13.10.2009 23:54:07
+1 good idea, and you can always change it's colour if needed.
Pool 15.10.2009 01:42:00
Yours is the best answer for most situations. Not gonna work for me, but thanks!
wallacer 25.11.2009 20:49:36

The issue isn't isolated to just Java applets. Flash and other plugins have the same issue. They do this save on resources and for backward compatibility.

I have cheated by changing visibility to hidden and setting the position to absolute and then putting it in a negative z order and other nasty tricks.

3
13.10.2009 22:55:54
ya I know it happens for all plugins. My particular problem was with an applet, so I structured my question to be a little more specific. Perhaps I'll try a combination of hidden and positioning as you mention.
wallacer 13.10.2009 23:05:44