HTML <object> Tag
In this article, we will discuss Tag object with examples. Wishing that it would serve the learning requirements.
The HTML <object> tag is used to embed external content such as images, videos, audio files, and other types of media into a web page. The <object> tag is used to create an object element, which can be used to embed different types of external content within a web page.
Below is an embedded image:
Example: 
Here is an embedded HTML page:
Example: 
Here is an embedded video:
Example: 
How to embed a youtube video using <object> tag:
Example: 
Here is an example of pdf with the object tag:
Example: 
Tag object Usage
The Tag object <object> indicates a container that holds external resources.
There are many types of external resources, such as web pages, pictures, media players, plug-ins, and so on.
The HTML <object> tag has several uses including:
- The <object> tag can be used to embed external resources such as images, videos, audio files, and other types of media into a web page.
- The <object> tag can be used to provide fallback content in case the external resource fails to load. This ensures that users still have access to important information even if the external resource is not available.
- The <object> tag allows for customization of the embedded content’s appearance and behavior. This can be useful for creating rich multimedia experiences or for providing additional functionality that is not available with HTML alone.
- The <object> tag can be used to embed interactive content such as Flash animations, Java applets, or other plugins within a web page. This can be useful for creating engaging and interactive experiences for users.
Attributes
Global
The Tag object <object> is compatible with Global attributes in HTML.
Event
The Tag object <object> is compatible with Event attributes in HTML.
Attributes List
Attribute | Value | Overview |
---|---|---|
typemustmatch | true/false | Determine if the type attribute and the actual content of the resource have to match to be rendered. |
data | URL | Provides the URL of the resource the object will utilize. |
form | form_id | Identifies the form of the object. |
height | pixels | The height of the object is determined. |
name | name | Provide a name for the object. |
type | media_type | Provides the media type for data contained in the data attribute. |
width | pixels | Sets the object’s width. |
usemap | #mapname | This field indicates the name of the client-side image map that will be linked to this object. |
Plug-ins
The Tag object <object> was developed to embed plug-ins in browsers.
A plug-in is a software program that enhances the capabilities of a browser.
There are many purposes for which can use plug-ins :
- You can run Java applets.
- You can run ActiveX controls.
- Show Flash movies.
- Display a map.
- Check for viruses.
- Make sure your bank ID is valid.
Cautions!
The majority of browsers no more accommodate Java applets or plug-ins.
No browser is compatible with ActiveX controls anymore.
Modern browsers also disable Shockwave Flash compatibility.
Browser Compatibility
Element | |||||
---|---|---|---|---|---|
<object> | Yes | Yes | Yes | Yes | Yes |
Predefined CSS
Browsers usually present the <object> element with the following default values:
object:focus { outline: none; }
Tag object Advantages
The <object> tag in HTML has several advantages:
- The <object> tag is a flexible tool for embedding various types of external content within a web page, including images, videos, audio files, and other types of media. It can also be used to embed interactive content such as Flash animations, Java applets, or other plugins.
- The <object> tag allows for customization of the embedded content’s appearance and behavior. This can be useful for creating rich multimedia experiences or for providing additional functionality that is not available with HTML alone.
- The <object> tag provides fallback options in case the external resource fails to load. This ensures that users still have access to important information even if the external resource is not available.
- The <object> tag can be used to provide accessible alternatives to multimedia content, such as captions, subtitles, or text descriptions.
- The <object> tag is supported by most modern browsers, making it a reliable tool for embedding external content within a web page.