I am writing a Java applet, and would like to know the best way to include it in a web page.

I'd like it to prompt the user to install JRE if she hasn't it already.
This feature should (ideally) work cross-browser on any OS Java runs on.
Another requirement is that the applet should not be loaded on page load, but after a user action, not to load the JVM on every page load.
I guess [this is the official SUN way](http://java.com/js/deployJava.js), but it uses `document.write()`, so I can't use it after the page has finished rendering.