LiveConnect is a Mozilla technology that bridges Java and JavaScript. Amazingly, they've started maintaining it again for recent versions of Firefox. In Firefox I can write e.g.
var d = new java.util.Date();
or use the Packages.
namespace if it's not a java.something
var d = new Packages.java.util.Date();
or I could go crazy and call a factory method in swing
Packages.javax.swing.Box.createVerticalBox();
easily instantiating any Java object. Is there an equivalent that works in ie?
As of Java 1.6 update 10, the Inter-Language LiveConnect Bridge attaches a Packages object to applets within the page, just like the Packages object available in Firefox. So in a page with at least one applet, even in Internet Explorer,
new document.applets[0].Packages.java.util.Date().toString();
returns the current date. It's also possible to register new converters for convenient access to non-Java languages running in the Java virtual machine. Of course JavaFX implements such a bridge.
It's not supposed to be necessary to wait for the applet to load before calling it from JavaScript but it's probably a good idea. The Java plugin will make JavaScript wait until the applet finishes loading or has an error. It is possible for the applet to call JavaScript in the web page as soon as Applet.init() is called.