Applet HTML

HTML <applet> Tag

The HTML <applet> tag is not supported in HTML5. To embed the Java applet in an HTML document, the HTML <applet> tag was used, but was deprecated in HTML 4.0. The HTML <object> and HTML <embed> elements are used in HTML 5 instead of the HTML <applet> tag. Along with the HTML <applet> tag, the use of Java applet is also deprecated. The use of plugins is not supported by most of the browsers nowadays.

Syntax:

<applet code="URL" height="300" width="200">.............</applet>

Example:

<!DOCTYPE html>  
<html>  
<body>  
<p>Example</p>  
<applet code="Shapes.class" align="right" height="300" width="400">  
<b>Java is needed to see this example.</b>  
</applet>  
</body>  
</html>

Explanation:

In the above example, we used the HTML <applet> tag to embed a Java applet in the current document.

Attributes:

Attribute Value Uses
code URL Used to define the URL of the Java applet class file.
width pixels Used to define the display width of the applet panel.
height pixels Used to define the display height of the applet panel.
align left

right

top

middle

bottom

Used to define the position of applet application relative to the surrounding content.
alt text Used to define an alternative text for an applet.
archive URL Used to define the archived or compressed version of an applet application.
object name Used to define the URL or reference to a serialized representation of an applet.
codebase URL Used to define the exact or relative URL of applets specified in the code attribute.
hspace pixels Used to define the horizontal space around the applet.
vspace pixels Used to define the vertical space around the applet.
name name Used to define the name of the applet.

Global Attributes:

All the HTML Global Attributes are supported by the HTML <applet> tag.

Event Attributes:

All the HTML Event Attributes are supported by the HTML <applet> tag.

Supporting Browsers:

Firefox and Safari.