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.
Pros Main Features
- 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
- Free certificates of completion
- Focused on data science skills
- Flexible learning timetable
Pros Main Features
- Simplistic design (no unnecessary information)
- High-quality courses (even the free ones)
- Variety of features
- Nanodegree programs
- Suitable for enterprises
- Paid Certificates of completion
Pros Main Features
- A wide range of learning programs
- University-level courses
- Easy to navigate
- Verified certificates
- Free learning track available
- 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
Chrome
All
Edge
All
Firefox
All
IE
All
Opera
All
Safari
All
Mobile browser support
Chrome
All
Firefox
All
Opera
All
Safari
-