HTML <object> tag

HTML <object> tag is used to embed multimedia files on webpage. The <object> tag can include multimedia files such as video, audio, image, PDF, Java Applets, or another page on your page.

HTML <param> tag also used with <object> tag to pass parameters to plugin which has been included with <object> tag.

If you insert text between the <object> and </object> tags, then it will only be displayed if the browser does not support the <object> tag.

Syntax

<object data="" type=""></object>  

Following are some specifications about the HTML <object > tag

DisplayInline
Start tag/End tagBoth Start and End tag
UsageEmbed external resource

Example

Embedding a Video:

<!DOCTYPE html>  

<html>  

<head>  

<title>Obejct Tag</title>  

</head>  

<body>  

 <h2>Example of Object tag</h2>  

 <object height="250" width="500" data="https://www.youtube.com/embed/O5hShUO6wxs"></object>  

</body>  

</html>

Output:

HTML object tag

Embedding a gif image:

<!DOCTYPE html>  

<html>  

<head>  

<title>Obejct Tag</title>  

</head>  

<body>  

 <h2>Example of Object tag</h2>  

 <object height="250" width="500" data="circle.gif">Sorry!,Your browser does not support</object>  

</body>  

</html>

Output:

HTML object tag

Attribute:

Tag-specific attributes:

AttributeValueDescription
dataURLIt specifies the address of the resource.
typecontent_typeIt determines the content type of the resource specified by data.
archiveURLIt specifies the space-separated list of URL’s for archives of resources for the object. (Not supported in HTML5).
borderpixelsIt sets the width of the border around the <object> (Not supported in HTML5).
classidURLIt specifies the URL for the object implementation. (Not supported in HTML5).
codebaseURLIt specifies the base path where to find the code for the object. (Not supported in HTML5).
formform_id Itspecifies the form element that the object element is associated with.
heightpixelsIt defines the height of the object.
widthpixelsIt determines the width of the object.
typemustmatchbooleanIt specifies that resource should be embedded if type attribute matches with the actual content type of the resources provided on the data attribute.
namenameIt defines the name for the object.

Global attribute:

The <object > tag supports the global attributes in HTML

Event attribute:

The <object > tag supports the event attributes in HTML.

Supporting Browsers

Elementchrome browser Chromeie browser IEfirefox browser Firefoxopera browser Operasafari browser Safari
<object>YesYesYesYesYes

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *