It’s Festive Season! Enjoy 30% Off

Use code FESTIVE30 at checkout

Code has been added to clipboard!

applet HTML Tag

Reading time 2 min
Published Jun 29, 2017
Updated Oct 2, 2019

applet HTML: Main Tips

  • The <applet> HTML used to embed Java applets into HTML files.
  • For embedding Java applet, HTML no longer recommends using the <applet> element.
  • Better options to learn how to use Java in HTML include <object> and <embed> elements.

How applet Was Used

The <applet> HTML element adds a Java applet to an HTML document. In the following example, Java applet draws a chess game:

Example
<applet code="chess.class">
  <p>You need Java to enjoy this game.<p>
</applet>

Warning: do not use this element for incorporating Java applet: HTML 5 removed this element and offers <object> and <embed> as alternatives.

Deprecated Attributes

code

It defined the URL of the class file of a Java applet.

Example
<applet code="chessgame.class">
  You need Java to play this game.
</applet>

align

It specified the alignment of an applet.

Example
<applet code="racing.class" align="center">
  You need Java to play this game.
</applet>

alt

It set an alternate text to an applet.

Example
<applet code="chess.class" alt="HTML applet example">
  This Java applet draws a chess game.
</applet>

archive

It indicated the location of a compressed or archived version of the applet.

Example
<applet archive="gamefiles.zip" code="chess.class">
  Sorry, you need Java to play this game.
</applet>

height

It defined the height of the applet (in pixels).

Example
<applet height="350" width="550" code="chatroom.class">
  This Java applet draws an online chatroom.
</applet>

width

It indicated the width of the applet (in pixels).

Example
<applet height="350" width="550" code="chatroom.class">
  This Java applet draws an online chatroom.
</applet>

name

It set a name to the Java applet.

Example
<applet name="chess" code="chessgame.class" height="350" width="550">
  This Java applet draws a chess game.
</applet>

Browser support

Browser image
Chrome
All
Browser image
Edge
All
Browser image
Firefox
All
Browser image
IE
All
Browser image
Opera
All
Browser image
Safari
All

Mobile browser support

Browser image
Chrome
All
Browser image
Firefox
All
Browser image
Opera
All
Browser image
Safari
-