HTML <param> tag
The <param> tag is used to define parameters of media files, plugins or embedded content for the <object> element.
It must be used only inside the <object> element. It has no end tag.
Type: Inline Element
Example of <param> tag
<object data="audio/nice.mp3"> <param name="autoplay" value="true"> </object>
Full code example
<!DOCTYPE html> <html> <head> </head> <body> <object data="demo.mp3" type="audio/mpeg"> <param name="autoplay" value="true"> <param name="loop" value="false"> </object> <object data="demo.mp4" type="video/mp4" width="400" height="300"> <param name="autoplay" value="false"> <param name="controls" value="true"> </object> </body> </html>
Why <param> tag is obsolete in HTML5?
HTML5 introduced many built-in media elements (like <video>, <audio>, <embed>) which replaced the function of the <param> tag. Modern browsers are not longer supported Flash object (.swf), Java applets and other browser plugins due to security risk and poor performance. In such way, <param> tag losts its purpose.
Example of replacement the function of <param> element by <audio> element (in case of embedding an audio file)
Using <param> tag (old ways)
<object data="song.mp3"> <param name="autoplay" value="true"> </object>
Using <audio> tag (valid ways)
<audio src="song.mp3" autoplay controls> </audio>
Supported Browsers
| Tag | Chrome | Internet Explorer | Firefox | Safari | Opera Mini |
|---|---|---|---|---|---|
| <param> | Yes | Yes | Yes | Yes | Yes |
Attributes of <param> tag
| Attribute | Value | Note |
|---|---|---|
| name | name | It specifies the parameter name. |
| type | media_type | It specifies the media type of the parameter. |
| value | value | It specifies the parameter value. |
| valuetype | data (Default) object reference |
It specifies the type of the parameter value. |
Even the <param> tag is obsolete in modern HTMLand so does it's attributes also.
1. name attribute
<object data="demo.mp3" type="audio/mpeg"> <param name="autoplay" value="true"> </object>
In the above example, name and value attributes are used with its corresponding value.
Here, name is the attribute name.
autoplay is the parameter name.
value is also attribute name.
true is the value passed to the object.
Overall, giving true value to the autolplay parameter means the audio file will start playing once the page loads.
2. type attribute
Flash (.swf) is not longer supported supported in modern HTML. The following example is only for learning.
<object data="demo.swf"> <param name="audio" value="demo.mp3" valuetype="ref" type="audio/mpeg"> </object>
In the above example, name, value, valuetype and type attributes are used with its corresponding value.
Here, name="audio" is the paramter name.
value="demo.mp3" is the referenced media file.
valuetype="ref" It defines that the value is a file reference (URL)
type="audio/mpeg" is the MIME type of the referenced file.
3. value attribute
<object data="demo.mp3" type="audio/mpeg"> <param name="loop" value="false"> </object>
In the above example, name and value attributes are used with its corresponding value.
Here, name is the attribute name.
loop is the parameter name.
value is also attribute name.
false is the value passed to the object.
Overall, giving false value to the loop parameter means the audio file will be stopped once it ends.
4. valuetype attribute
There are three values of valuetype attribute - data, object and reference
Example of valuetype="data" (default)
<object data="player.swf"> <param name="audioFile" value="song.mp3" valuetype="data"> </object>
Example of valuetype="ref"
<object data="audioPlayer.swf"> <param name="audioURL" value="song.mp3" valuetype="ref"> </object>
In the above example, <object> element defines an audio player Flash file (audioPlayer.swf) which is no longer supported in modern HTML and browser.
name="audioURL" - defines the parameter name of the audio file.
value="song.mp3" - defines the audio file name.
valuetype="ref" - defines the value is treated as a URL.
Example of valuetype="object"
It allows one Flash object to control another audio player.
<object id="audioPlayer" data="audioPlayer.swf"></object> <object data="audioController.swf"> <param name="target" value="audioPlayer" valuetype="object"> </object>
In the above example, first <object> element defines an audio player Flash object (audioPlayer.swf) which is no longer supported in modern HTML and browser. Giving an unique id (audioPlayer) allows to use by other <object> element.
Second <object> element loads an audio controller Flash file.
name="target" - defines which object has to control.
value="audioPlayer" - references the first <object>'s ID.
valuetype="object" - defines an object reference, not plain text.
Default CSS property of <param> tag
param { display:none; }
