Skip to content
Related Articles

Related Articles

HTML | applet Tag
  • Last Updated : 30 Jul, 2019

The <applet> tag in HTML was used to embed Java applets into any HTML document. The <applet> tag was deprecated in HTML 4.01, and it’s support has been completely discontinued starting from HTML 5. Alternatives available in HTML 5 are the <embed> and the <object> tags.


<applet attribute1 attribute2....>
   <param parameter1>
   <param parameter2>

Attributes: The <applet> tag takes a number of attributes, with one of the most important being the code attribute. This code attribute is used to link a Java applet to the concerned HTML document. It specifies the file name of the Java applet.

<!DOCTYPE html> 
    <applet code="HelloWorld" width=200 height=60

Here, HelloWorld is the class file, which contains the applet. The width and height attributes determine the width and height of the applet in pixels when it is opened in the browser.

Attributes available to be used in conjunction with the <applet> tag are as follows:

Attribute NameValuesRemarks
Specifies the alignment of an applet.
alttextSpecifies an alternate text for an applet
archiveURLSpecifies the location of an archive file
borderpixelsSpecifies the border around the applet panel
codebaseURLSpecifies a relative base URL for applets specified in the code attribute
heightpixelsSpecifies the height of an applet
hspacepixelsDefines the horizontal spacing around an applet
mayscriptAny arbitrary value (conventionally “mayscript”)Indicates whether the Java applet is allowed to access the scripting objects of the web page
namenameDefines the name for an applet (to use in scripts)
vspacepixelsDefines the vertical spacing around an applet
widthpixelsSpecifies the width of an applet

Parameters: Parameters are quite similar to command-line arguments in the sense that they provide a way to pass information to the applet after it has started. All the information available to the applet before it starts is said to be hard-coded i.e. embedded within it. Parameters make it possible to generate and use data during run-time of the applet.


<param name=parameter_name value=parameter_value>

The name assigned to the name attribute of the param tag is used by the applet code as a variable to access the parameter value specified in the value attribute. In this way, the applet is able to interact with the HTML page where it is embedded, and can work on values provided to it by the page during run-time.

<!DOCTYPE html>
    <applet code="HelloWorld" width=200 height=60>
    <param name="message" value="HelloWorld"

In this piece of code, the applet file HelloWorld can use the variable named message to access the value stored in it, which is “HelloWorld”.

Note: There is still some browsers that support the <applet> tag with the help of some additional plug-ins/installations to work. Internet Explorer 11 and earlier versions with the help of plug-ins.

Supported Browsers: The browser supported by <applet> tag are listed below :

  • Firefox
  • Safari


My Personal Notes arrow_drop_up
Recommended Articles
Page :