HTML <param> Tag
The <param> tag in HTML is used to define parameters for embedded objects, specified by the <object> tag. These parameters provide instructions or data that an object, like a Flash movie, Java applet, or other types of plugins, needs to function correctly or to customize its behavior. The <param> tag is always used inside an <object> tag.
Syntax
<param name="parameter_name" value="parameter_value">
Attributes
| Attribute | Value | Description |
|---|---|---|
| name | parameter_name | Specifies the name of the parameter. This name is used by the object to identify what setting or data the value provides. |
| value | parameter_value | Specifies the value of the parameter. This is the actual setting or data that the object will use. |
Example
<object data="my_applet.class" type="application/x-java-applet">
<param name="code" value="my_applet.class">
<param name="width" value="300">
<param name="height" value="200">
<p>Your browser does not support Java applets.</p>
</object>
More Examples
Example 1: Configuring a Flash Player
In the past, Flash movies required several parameters to be set correctly within an object tag. While Flash is deprecated, it serves as a good example of how <param> elements were used.
<object data="my_flash.swf" type="application/x-shockwave-flash">
<param name="movie" value="my_flash.swf">
<param name="quality" value="high">
<param name="bgcolor" value="#FFFFFF">
<param name="allowFullScreen" value="true">
<p> Your browser does not support flash content </p>
</object>
Explanation:
movie: Specifies the path to the Flash file.quality: Sets the rendering quality.bgcolor: Specifies the background color.allowFullScreen: Allows the Flash content to go full screen.
Example 2: Using Parameters with Java Applets
Here's how parameters can be used with a Java applet. Note that Java applets are also largely outdated but demonstrate the usage of <param>.
<object type="application/x-java-applet" height="300" width="300">
<param name="code" value="MyApplet.class">
<param name="param1" value="Hello">
<param name="param2" value="World">
<p>Your browser does not support Java applets.</p>
</object>
Explanation:
code: Specifies the main class file of the Java applet.param1andparam2: Custom parameters passed to the applet. The specific interpretation of custom parameters depends on how the Java applet is programmed.
Example 3: Using Parameters with other plugins
Though not as widely used as Flash or Java Applets used to be, plugins like Silverlight or other custom plugins could also use <param> to pass initialization parameters.
<object type="application/x-my-custom-plugin" data="myplugin.xpi" width="500" height="400">
<param name="setting1" value="optionA">
<param name="api_key" value="xxxxxxxxxxxxxxx">
<p>This content requires a plugin to display.</p>
</object>
Explanation:
data: Path to the plugin.setting1: A specific setting for the plugin, in this case a string value.api_key: Another example of a setting, perhaps an API key for the plugin to make calls to.
Browser Support
The <param> tag is supported by all major browsers.
| Browser | Support |
|---|---|
| Chrome | Yes |
| Edge | Yes |
| Firefox | Yes |
| Safari | Yes |
| Opera | Yes |
Notes and Tips
- The
<param>tag must be nested within an<object>tag to work correctly. - The parameters required are defined by the specific object or plugin, which needs to be consulted to determine what names and values are needed.
- Parameters passed using
<param>are usually read by the object during its initialization. - While plugins like Flash and Java applets are not widely used now, the
<param>tag remains relevant for situations involving embedded objects that require configuration parameters. - Make sure that the
nameattribute of the<param>tag corresponds to the parameter expected by the object, or the parameters may be ignored. - Use appropriate
typeattribute within the<object>tag that matches the type of the object that you are embedding. - It is important to provide fallback content within the
<object>tags for browsers that do not support the embedded object type. - The
<param>tag is an empty tag and does not have a closing tag.








