views:

45

answers:

2

Due to timing issues, I'm trying to prevent an applet from loading until a page is completely loaded ($(document).ready(...);). However, I'm using the java deployment toolkit to launch the applet, which naively uses document.write to push data to the browser. Obviously, this breaks horribly if I attempt to run the applet after the is written.

How, therefore, can I prevent the applet from initializing until I want it to?

A: 

Don't use the deploymenttoolkit to write out your applet tag. Then you can have complete control over when it is placed into the output (cf the old documentation here).

jsight
I wanted the cross-platform deployment abstracted away, so I wound up overwriting document.write to push data to a div during the duration of the runApplet call. :)This is dirty, but it requires the least code change, and it allows my deployment to realize the bugfixes of the deployment toolkit with minimal maintenance.
Stefan Kendall
@iftrue - You don't necessarily have to throw out all of deploymenttoolkit just to get rid of the applet generation side. It has fairly nice APIs for detecting the version and doing redirection without generating any applet code at all. Thats what we do here, and it works pretty well.
jsight
A: 

Overriding document.write, call the deployment script, and then re-set document.write.

Stefan Kendall