The HTML <applet> tag is used to embed Java applets, which are small programs written in Java that run within a web browser. This tag is used to add interactive content, such as animations or complex calculations to the webpage. It specifies the location of he Java applet class file and allows passing parameters to the applet using the <param>.
SyntaxThis tag is no longer recommended as it is deprecated, So instead of using the <applet> we can use <object> or <embed> tags.
Following is the syntax of HTML <applet> tag −.
<applet code="URL" height="200" width="100"> ... </applet>Attributes
HTML applet tag supports Global and Event attributes of HTML. Accepts some specific attributes as well which are listed below.
Attribute Value Description align leftLet's look at the following example, where we are going to embedding a java applet in a HTML document.
<!DOCTYPE html> <html> <head> <title>HTML applet Tag</title> </head> <body> <applet code = "newClass.class" width = "300" height = "200"></applet> </body> </html>
Here is the newClass.java file
import java.applet.*; import java.awt.*; public class newClass extends Applet { public void paint (Graphics gh) { g.drawString("Tutorialspoint.com", 300, 150); } }Supported Browsers
html_deprecated_tags.htm
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4