HTML applet Tag

HTML <applet> Tag: The applet tag is used to embed Java applets in embedded tag. And the applet tag is supported by HTML 4.01 but it is not supported by HTML5 version. Alternatives available in HTML 5 are the <embed> and the <object> tags.

 HTML <applet> Tag

The <applet> tag takes a number of attributes, with one of the most important being the code attribute. This code attribute is used to link a Java applet to the concerned HTML document. It specifies the file name of the Java applet.

Syntax: <applet code=” ” width=” ” height=” “>–content–</applet>



Browser compatibility

The <applet> tag is supported by Chrome, Firefox, Safari, Internet Explorer and Opera browsers.

Example:

<applet code="Freshersnow.class" width="250" height="250">
Freshersnow tutorials.
</applet>

Output:

Freshersnow tutorials.

Attributes supported by the <applet> tag

Attribute Value Description
code URL specifies the file name of a java applet
object name Specifies a reference to a serialized representation of an applet
align left
right
top
bottom
middle
baseline
Specifies the alignment of an applet according to surrounding elements
alt text Specifies an alternate text for an applet
archive URL Specifies a relative base URL for applets specified in the code attribute
codebase URL Specifies a relative base URL for applets specified in the code attribute
height pixels Specifies the height of an applet
hspace pixels Defines the horizontal spacing around an applet
vspace pixels Defines the vertical spacing around an applet
name name Defines the name for an applet
width pixels Specifies the width of an applet