🚨 Time is Running Out: Reserve Your Spot in the Lucky Draw & Claim Rewards! START NOW

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.

DataCamp
Pros
  • Easy to use with a learn-by-doing approach
  • Offers quality content
  • Gamified in-browser coding experience
  • The price matches the quality
  • Suitable for learners ranging from beginner to advanced
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable
Udacity
Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid Certificates of completion
edX
Pros
  • A wide range of learning programs
  • University-level courses
  • Easy to navigate
  • Verified certificates
  • Free learning track available
Main Features
  • University-level courses
  • Suitable for enterprises
  • Verified certificates of completion

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
-