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

Chrome
All
Edge
All
Firefox
All
IE
All
Opera
All
Safari
All

Mobile browser support

Chrome
All
Firefox
All
Opera
All
Safari
-
Basics
Introduction
Syntax
Editors
Basic Examples
Head Section
<!DOCTYPE>
Tags and Elements
Semantic Elements
Tags Reference
Attributes
Comments
Block and Inline Elements
Forms
Form Elements
Input
Responsive Web Design
Inline Scripts
Uniform Resource Locator
Redirect
XHTML
Geolocation
Drag and Drop
Local Storage
Web Workers
Server-Sent Events
Character Encoding
Text Formatting
Quotation and Citation Elements
Headings
Paragraphs
Links
Tables
Lists
Symbols
Space
Tab
Styles
Computer Code
Layout
Classes
Colors
Images
iframes
Audio Player
Video Player
YouTube Videos
Multimedia
Canvas
SVG
<!-- -->
<a>
<abbr>
<acronym> DEPRECATED
<address>
<applet> DEPRECATED
<article>
<aside>
<audio>
<b>
<base>
<basefont> DEPRECATED
<bdi>
<bdo>
<big> DEPRECATED
<blink> DEPRECATED
<blockquote>
<body>
<br>
<button>
<canvas>
<caption>
<center> DEPRECATED
<cite>
<code>
<col>
<colgroup>
<datalist>
<dd>
<del>
<details>
<dfn>
<dialog>
<dir> DEPRECATED
<div>
<dl>
<dt>
<em>
<embed>
<fieldset>
<figcaption>
<figure>
<font> DEPRECATED
<footer>
<form>
<frame> DEPRECATED
<frameset> DEPRECATED
<h1> – <h6>
<head>
<header>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<kbd>
<keygen> DEPRECATED
<label>
<legend>
<li>
<link>
<main>
<map>
<mark>
<menu>
<menuitem> DEPRECATED
<meta>
<meter>
<nav>
<noframes> DEPRECATED
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike> DEPRECATED
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt> DEPRECATED
<u>
<ul>
<var>
<video>
<wbr>