By the end of this tutorial, you’ll understand legacy Java applet markup and what to use instead in modern web development.
01
Original Syntax
How <applet> embedded Java programs with code, width, and height.
02
Key Attributes
Understand codebase, archive, alt, and <param> configuration.
03
Historical Use Cases
Games, charts, animations, and interactive demos before JavaScript matured.
04
Obsolete Status
Why HTML5 removed <applet> and discontinued the Java Plugin.
05
Modern Alternatives
Replace applets with JavaScript, Canvas, WebGL, CSS, and WebAssembly.
06
Legacy Maintenance
Know when you’ll encounter applet in old codebases and how to migrate away.
Fundamentals
What Is the <applet> Tag?
The applet element (<applet>) was used to embed a Java applet—a compiled Java program (.class file) that executed inside the browser via the Java Plugin. Applets enabled interactive animations, games, charts, and calculators before JavaScript matured.
⚠️
Obsolete in HTML5
The <applet> tag is removed from the HTML5 specification and no longer supported by modern browsers. Java applets required a browser plugin that has been discontinued. Do not use this tag in any new project.
As of HTML5, the tag is obsolete. Browsers have removed Java Plugin support due to security vulnerabilities and the availability of safer, native web technologies like JavaScript and HTML5 Canvas.
Foundation
📝 Syntax
The syntax involved specifying attributes like code, width, and height to define the applet’s properties, with fallback content inside the tag:
syntax.html
<!-- Legacy Java applet syntax --><appletcode="YourAppletClass.class"width="300"height="200"><!-- Alternative content if the applet cannot be displayed -->
Your browser does not support the <code><applet></code> tag.
</applet>
Syntax Rules
code points to the compiled Java .class file to execute.
width and height set the display area in pixels.
Fallback content inside the tag displays when the applet cannot run (all modern browsers).
<param> child elements pass name/value pairs to the Java program.
Cheat Sheet
⚡ Quick Reference
Attribute
Code Snippet
Purpose
code
code="MyApplet.class"
Path to the compiled Java class file
width / height
width="300" height="200"
Dimensions of the applet display area
codebase
codebase="/applets"
Base directory for class files and archives
archive
archive="app.jar"
Comma-separated list of JAR archives
alt
alt="Java animation demo"
Short description when the applet cannot load
<param>
<param name="speed" value="fast">
Passes configuration values to the applet
Reference
🧰 Attributes
The <applet> tag supported several attributes for configuring the embedded Java program:
codeRequired
Specifies the applet’s compiled Java class file (e.g. MyApplet.class).
code="Animation.class"
width / heightRequired
Defines the width and height of the applet display area in pixels.
width="400" height="300"
codebaseOptional
Base URL or directory path for the applet’s class files and archives.
codebase="/applets"
archiveOptional
One or more JAR files containing the applet and its dependencies.
archive="app.jar,lib.jar"
altA11y
Alternative text for browsers that cannot display the applet.
alt="Java animation demo"
<param>Child
Child elements that pass name/value configuration to the Java program.
<param name="color" value="blue">
All applet attributes are historical only. The entire element is obsolete in HTML5.
Hands-On
Examples Gallery
Historical Java applet patterns with copy-ready code. Modern browsers show only the fallback content inside the tag.
Basic Syntax
The simplest historical form: specify the Java class, dimensions, and fallback content for browsers without applet support (which today means all modern browsers).
basic-applet.html
<appletcode="YourAppletClass.class"width="300"height="200">
Your browser does not support the <code><applet></code> tag.
</applet>
In the past, the <applet> tag was widely used for integrating Java applets into web pages—animations, data visualizations, educational demos, and games. Due to security concerns and the evolution of web technologies, Java applets have become outdated.
Parameters & codebase
Developers passed configuration to applets using <param> child elements and set the class file location with codebase and archive attributes.
applet-parameters.html
<appletcode="Animation.class"codebase="/applets"width="400"height="300"alt="Java animation demo"><paramname="speed"value="fast"><paramname="color"value="blue">
Java applets are no longer supported in modern browsers.
</applet>
Java applets are no longer supported in modern browsers.
History
🚫 Deprecated Status
The <applet> tag is deprecated and obsolete. It is no longer recommended for use in modern web development.
SecurityCritical
Java applets were a frequent attack vector and major security vulnerability in browsers.
Plugin dependencyRemoved
Required a separate Java browser plugin, now discontinued in all major browsers.
PerformanceIssue
Slower startup and higher memory use compared to native JavaScript and WebAssembly.
AlternativesModern
JavaScript, Canvas, WebGL, CSS animations, and WebAssembly are safer and faster.
Migration
🚀 Modern Alternatives
Given the obsolete status of <applet>, use these technologies for interactive web content today:
JavaScriptNative
DOM manipulation, events, and application logic without browser plugins.
document.querySelector(...)
Canvas / WebGLGraphics
2D drawings, games, and 3D visualizations directly in the browser.
<canvas id="game"></canvas>
CSS AnimationsMotion
Transitions and keyframe animations without Java or plugins.
@keyframes fadeIn { ... }
WebAssemblyWASM
Near-native performance for compute-heavy browser applications.
WebAssembly.instantiate(...)
Guidance
🧐 Considerations
If you encounter <applet> in legacy code, plan to remove or replace it. Modern web development relies on JavaScript, HTML5, and CSS for creating dynamic and interactive content. For maintaining old sites, document the applet functionality and rebuild with current web APIs.
🧠 How Java Applets Worked
1
Browser loads the page
The parser encounters <applet> and reads code, width, height, and param values.
Markup
2
Java Plugin starts
The browser plugin downloaded and executed the .class or .jar file inside a sandboxed Java runtime.
Plugin
3
Applet renders interactively
The Java program drew graphics and handled user input within the allocated width and height.
Runtime
=
🔄
Today: use web-native tech
JavaScript and HTML5 APIs deliver the same interactivity without plugins. The <applet> tag exists only in web history and legacy maintenance.
Compatibility
Browser Support
The <applet> tag has no functional support in modern browsers. All major browsers have removed Java Plugin support. The tag should be treated as non-functional in modern environments.
⚠ Obsolete · Plugin removed
Non-functional in modern browsers
All major browsers have removed Java Plugin support. Modern browsers show only the fallback content inside the <applet> tag—the Java program itself will not execute.
0%Modern support
Google ChromePlugin removed · Obsolete
Not supported
Mozilla FirefoxPlugin removed · Obsolete
Not supported
Apple SafariPlugin removed · Obsolete
Not supported
Microsoft EdgePlugin removed · Obsolete
Not supported
Internet ExplorerLegacy plugin only · EOL
Legacy only
OperaPlugin removed · Obsolete
Not supported
Why applets were removed
Security, performance, and native web technology maturity drove universal deprecation.
🔒
Security vulnerabilitiesJava applets were a frequent attack vector in browsers
Critical
⚡
JavaScript & CanvasNative web APIs replaced applets for interactivity
Replacement
<applet> tag0% modern support
Bottom line: Learn <applet> for legacy maintenance only. Use JavaScript, Canvas, or WebAssembly for all new interactive content.
Wrap Up
Conclusion
While the <applet> tag played a significant role in early web development, its deprecated status makes it unsuitable for modern web projects.
Developers should adopt contemporary technologies—JavaScript, HTML5 Canvas, CSS, and WebAssembly—to create dynamic and engaging web content without relying on discontinued browser plugins.