how to with some little tricks make a soft integration of an Applet in an HTML web page....
Something that may explain the lack of succes of Java Applet over WWW is maybe the poor loading/destroy process quality of an Applets embedded into a Browser:
The first thing thing we may notice is that annoying Java Splash Screen that differ for every JVM version,
This point is removed in this sample, by starting the applet in an unviewable area of the browser by setting the top css position to -5000 before applet start loading, than by monitoring the isActive method we can know when JavaSplashScreen have disapear and set the top css position to nothing.
JVM starting hang when first Applet is started in a brower session.
- As we cannot get ride of this point, we will resolve it by a simple trick, we will preload the smallest possible applet (code=java.applet.Applet) just after the onlad event of the body, doing that way, it will be less noticable by our visitor.
We cannot easily know the time the applet will requiere to be download, and so we are unable to provide a progress bar:
- This point may be resolved using server side script, unfortunatly thi will make things become too much complex and will also make this script depending uppon server language, so we will rexolve this point using a well know trick wich is an animated gif that can loop infinitly.
Java is crossplatform and crossbrowser so our loader must be too:
- This make the script a little longer but this one works with all JVM including MS JVM, tested on FF 2.0, IE 6.0 & Safari 3.0., works best with IE.
Applet are not properly removed from memory once stopped :
- Unfortunatly it is not possible to resolve this point as we have no control on applets our visitor have already opened/closed. It is not possible to make a cross JVM code resolving this issue....
Recent IE browser requiere that user "click on" Applet to activate and enable focus:
Last but not least we must make all the above simple to implement:
- All applet use an APPLETLOAD tag rather than the well know APPLET tag, this way the script is able to detect, load and show applets automatically with minimum HTML source code modifications.
to see HTML AppletLoad tag details, use "view source code" with your browse on this page.