HTML Encyclopaedia

The applet tag

The HTML container element

<applet> ... </applet>
is used for the inclusion or embedding of Java applets into HTML.

Text contained within the <applet> ... </applet> tags is ignored by Java capable browsers but will be displayed by non-Java capable browsers which will, of course, have ignored the unrecognised tags.

The tag has 9 attributes which are mostly very similar to the attributes of the <img> tag and control the positioning and characteristics of the applet display area.

The attributes are

  1. codebase

    This optional attribute's value specifies the directory from which the applet is loaded. If it is omitted the applet is loaded from the same directory as the page.

  2. code

    The value of this mandatory attribute identifies the compiled class file containing the applet code.

  3. alt

    The value of this attribute is text to be displayed by browsers that recognise the <applet> tag but can't actually handle Java, perhaps because the class libraries are missing on the browser host, or because the user has switched Java loading off.

  4. name

    The value of this attribute names the applet so that other applets (on the same page) can communicate with it.

  5. width

    Specify display area width in pixels. The HTML 3.2 standard implies that the use of percentage of window size is not allowed in this context.

  6. height

    Specify display area height in pixels. The HTML 3.2 standard implies that the use of percentage of window size is not allowed in this context.

  7. align

    The value of this attribute specifies the alignment of the display area relative to the current text. The values and their meanings are the same as for the <img> tag. Except that the values texttop, absmiddle, baseline and absbottom are also mentioned by the HTML 3.2 standard. These values are not otherwise mentioned by the HTML 3.2 standard and their significance is nowhere explained. They were used in some earlier versions of the Netscape browser for precise control of image positioning relative to ascenders/descenders etc., of text lines. Their occurence in the HTML 3.2 standard may well be an error.

  8. vspace

    Specifies height in pixels of the vertical boundary around the display area.

  9. hspace

    Specifies width in pixels of the horizontal boundary around the display area.

The attributes code, width, height and align are noted as required or mandatory in the HTML 3.2 standard.
See also <param>.