embedding Java™ applets

This section will show you to to embed Java™ applets using valid XHTML. Therefore you will have to get the browser. In JavaScript you do this with this simple piece of code:

<script type="text/javascript"><!--
var _app = navigator.appName;
//--></script>

The variable _app may now be one of these values:


value
meaning
Netscape
indicates the following browsers: Firefox, Netscape Navigator, and also Safari
Konqueror
indicates the Konqueror browser
Opera
shows, you are using the Opera browser
Microsoft Internet Explorer
indicates the Internet Explorer by Microsoft

So you now can use some if-statements to choose the right code for each individual browser. Below you will find the XHTML compliant code for inserting Java™ applets to your page depending on the browser. It demonstrates inserting an Java™-applet showing the scroller-applet. You may see that MS Internet Explorer is something special.


XHTML compliant code for Firefox, Netscape Navigator, Safari, Konqueror and Opera:
<object classid="java: scroller.class"
codetype="application/java-vm" width="450" height="24">
<param name="file" value="scrolling.txt" />
<param name="foreground" value="FFFFFF" />
<param name="background" value="3366CC" />
<param name="font" value="14, Arial, BOLD" />
<param name="speeddelay" value="60" />
<param name="msgdelay" value="1000" />
<param name="left" value="30" />
</object>

XHTML compliant code for Microsoft Internet Explorer:
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
codetype="application/java-vm" width="450" height="24">
<param name="code" value="scroller.class" />
<param name="file" value="scrolling.txt" />
<param name="foreground" value="FFFFFF" />
<param name="background" value="3366CC" />
<param name="font" value="14, Arial, BOLD" />
<param name="speeddelay" value="60" />
<param name="msgdelay" value="1000" />
<param name="left" value="30" />
</object>

last update: 2010-11-16 - 19:45:49.
copyright © by Klaus Burgstaller 2009