7.4 Applets in HTML
7.4 Applets in HTML
HTML <applet> tag was used to embed the Java applet in an HTML document. This
element has been deprecated in HTML 4.0 and instead of it we can use <object> and
newly added element <embed>.
The use of Java applet is also deprecated, and most browsers do not support the use of
plugins.
Note: The <applet> tag is deprecated in HTML4.0 and not supported in HTML5. So you can
use <object> tag or <embed> tag instead of <applet>.
Syntax
Display Block
Example
1. <!DOCTYPE html>
2. <html>
3. <head>
4. <title>Applet Tag</title>
5. </head>
6. <body>
7. <p>Example of Applet Tag</p>
8. <applet code="Shapes.class" align="right" height="200" width="300">
9. <b>Sorry! you need Java to see this</b>
10. </applet>
11. </body>
12. </html>
Attributes
Specific Attributes
codebase URL It specifies the exact or relative URL of applets .class file
specified in the code attribute.