HTML <applet>

fa125had's avatar
Published Mar 24, 2022Updated Jun 12, 2024
Contribute to Docs

The <applet> element was used to embed Java applets into an HTML page. It has since been deprecated and removed from the HTML specification. This tag should no longer be used as browsers no longer support it.

  • Front-end engineers work closely with designers to make websites beautiful, functional, and fast.
    • Includes 34 Courses
    • With Professional Certification
    • Beginner Friendly.
      115 hours
  • Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.
    • Beginner Friendly.
      7 hours

Syntax

The original syntax for the <applet> element looked like this:

<!-- This is no longer supported -->
<applet code="url of Java class file" width="300" height="300">
Text displayed when no Java runtime is available.
</applet>
  • code: This attribute specifies the URL for the Java class file.

Note: The <applet> element could also use common attributes like width and height to define its dimensions on the page. It could also include one or more <param> tags to pass parameters to the Java applet.

The <applet> element is deprecated due to security and compatibility concerns. The <object> or <embed> tags can be used as modern alternatives.

Example

The following image shows an example applet:

An image showing an example of a Java applet in a historical web context

All contributors

Contribute to Docs

Learn HTML on Codecademy

  • Front-end engineers work closely with designers to make websites beautiful, functional, and fast.
    • Includes 34 Courses
    • With Professional Certification
    • Beginner Friendly.
      115 hours
  • Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.
    • Beginner Friendly.
      7 hours