简体   繁体   中英

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM