The
<applet>tag in HTML was used to embed Java applets (small Java programs) into a web page.
Applets could display interactive graphics, animations, or run other Java-based functionalities directly within the browser.
However, the<applet>tag is deprecated in HTML5 and should no longer be used — it has been replaced by the<object>or<embed>tag.
Syntax
<applet code="ClassFileName.class" width="300" height="200">
Your browser does not support Java applets.
</applet>Attributes
| Attribute | Description |
|---|---|
code | Specifies the name of the Java class file to be loaded. |
archive | Specifies the location of the applet’s .jar file. |
codebase | Defines the base URL for the applet’s class files. |
width | Specifies the display width of the applet. |
height | Specifies the display height of the applet. |
name | Assigns a name to the applet instance. |
alt | Provides alternate text for browsers that do not support Java applets. |
object | Specifies the serialized applet object. |
align | Defines alignment relative to surrounding elements. |
hspace | Sets horizontal space around the applet. |
vspace | Sets vertical space around the applet. |
Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Applet Tag Example</title>
</head>
<body>
<h2>HTML <applet> Tag Example</h2>
<applet code="HelloWorld.class" width="300" height="200">
Your browser does not support Java applets.
</applet>
<p><strong>Note:</strong> Modern browsers no longer support Java applets. Use the <object> tag instead.</p>
</body>
</html>Output
Browser Output
There is no visible output in modern browsers because Java applets are no longer supported.
To experience similar functionality, you can embed JavaScript or use the <object> tag instead.
Please use our TryIt Editor to test HTML structure (output will not render).
Browser Support
Chrome | Firefox | Edge | Safari | Opera | IE9+ |
|---|---|---|---|---|---|
| ❌No | ❌No | ❌No | ❌No | ❌No | ⚠️Partial |
No browser support this <applet> tag now except of some older version of IE.
Notes
- The
<applet>tag was officially deprecated in HTML 4.01 and removed in HTML5. - Java plug-ins are now considered insecure and have been removed from most browsers.
- For modern replacements, use
<object>,<embed>, or JavaScript-based web apps.
Conclusion
The <applet> tag was used to embed Java programs directly into web pages but is now obsolete.
Modern web development standards have replaced it with safer and more compatible technologies like JavaScript, <object>, <embed>, or WebAssembly.