Horje
What is HTML <object> Tag

The HTML element represents an external resource, which can be treated as an image, a nested browsing context, or a resource to be handled by a plugin.

Definition and Usage

The <object> tag defines a container for an external resource.

The external resource can be a web page, a picture, a media player, or a plug-in application.

To embed a picture, it is better to use the <img> tag.

To embed HTML, it is better to use the <iframe> tag.

To embed video or audio, it is better to use the <video> and <audio> tags.


Browser Support

Plug-ins

The <object> tag was originally designed to embed browser Plug-ins.

Plug-ins are computer programs that extend the standard functionality of the browser.

Plug-ins have been used for many different purposes:

  • Run Java applets
  • Run ActiveX controls
  • Display Flash movies
  • Display maps
  • Scan for viruses
  • Verify a bank id

Warning !

Most browsers no longer support Java Applets and Plug-ins.

ActiveX controls are no longer supported in any browser.

The support for Shockwave Flash has also been turned off in modern browsers.


Attributes

Attribute Value Description
data URL Specifies the URL of the resource to be used by the object
form form_id Specifies which form the object belongs to
height pixels Specifies the height of the object
name name Specifies a name for the object
type media_type Specifies the media type of data specified in the data attribute
typemustmatch true/false Specifies whether the type attribute and the actual content of the resource must match to be displayed
usemap #mapname Specifies the name of a client-side image map to be used with the object
width pixels Specifies the width of the object

Global Attributes

The <object> tag also supports the Global Attributes in HTML.


Event Attributes

The <object> tag also supports the Event Attributes in HTML.

HTML DOM reference: Object Object


How to create HTML <object> Tag

<object type="application/pdf" data="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object" width="250" height="200"></object>

Output should be:

How to create HTML <object> Tag

How to create An embedded image on HTML <object> Tag

Add an image into HTML <object> Tag

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The object element</h1>

<object data="https://horje.com/avatar.png" width="300" height="200"></object>
 
</body>
</html>

Output should be:

How to create An embedded image on HTML <object> Tag

How to create An embedded HTML page on HTML <object> Tag

See the Example

index.html
Example: HTML
 <object data="https://horje.com/" width="500" height="200"></object> 

Output should be:

How to create An embedded HTML page on HTML <object> Tag

How to create An embedded video on HTML <object> Tag

See the Example.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<object data="https://file-examples.com/storage/fe58a1f07d66f447a9512f1/2017/04/file_example_MP4_480_1_5MG.mp4" width="400" height="300"></object>
 
</body>
</html>

Output should be:

How to create An embedded video on HTML <object> Tag

How to set Default CSS Settings on HTML <object> Tag

Most browsers will display the <object> element with the following default values.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<style>
object:focus {
  outline: none;
}
</style>
<body>

<object data="https://file-examples.com/storage/fe58a1f07d66f447a9512f1/2017/04/file_example_MP4_480_1_5MG.mp4" width="400" height="300"></object>
 
</body>
</html>

Output should be:

How to set Default CSS Settings on HTML <object> Tag

What is HTML <object> data Attribute

HTML is designed with extensibility in mind for data that should be associated with a particular element but need not have any defined meaning. data-* attributes allow us to store extra information on standard, semantic HTML elements without other hacks such as non-standard attributes, or extra properties on DOM.

Definition and Usage

The data attribute specifies the URL of the resource to be used by the object.


Browser Support

Syntax

<object data="URL">

Attribute Values

Value Description
URL Specifies the URL of the resource to be used by the object.

Possible values:

  • An absolute URL - points to data on another web site (like href="http://www.example.com/images/pic_trulli.jpg")
  • A relative URL - points to data within a web site (like href="pic_trulli.jpg")

How to create HTML <object> data Attribute

How to use the <object> element to embed an image.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The object element</h1>

<object data="https://horje.com/avatar.png" width="300" height="200"></object>
 
</body>
</html>

Output should be:

How to create HTML <object> data Attribute

What is HTML <object> form Attribute

The HTML <object> form Attribute is used to specify the one or more forms that the <object> Element.

Definition and Usage

The form attribute specifies the form the object belongs to.

The value of this attribute must be equal to the id attribute of a <form> element in the same document.


Browser Support

Syntax

<object form="form_id">

Attribute Values

Value Description
form_id Specifies the <form> element the <object> element belongs to. The value of this attribute must be the id attribute of a <form> element in the same document.

How to create HTML <object> form Attribute

An <object> element located outside a form (but still a part of the form).

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The object form attribute</h1>

<form action="/action_page.php" id="form1">
First name: <input type="text" name="fname"><br>
<input type="submit" value="Submit">
</form>

<object data="https://horje.com/avatar.png" width="300" height="200"></object>

<p><b>Note:</b> The form attribute is not supported in any of the major browsers.</p>

</body>
</html>

Output should be:

How to create HTML <object> form Attribute

What is HTML <object> height Attribute

The height attribute on an <object> tag sets the height of the object element.

The height is specified in pixels - without the ‘px‘ unit.

Definition and Usage

The height attribute specifies the height of the object, in pixels.


Browser Support

Syntax

<object height="pixels">

Attribute Values

Value Description
pixels The height of the object, in pixels (i.e. height="100")

How to add HTML <object> height Attribute

An embedded image with a height of 300 pixels and a width of 200 pixels:

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The object element</h1>

<object data="https://horje.com/avatar.png" width="300" height="200"></object>
 
</body>
</html>

Output should be:

How to add HTML <object> height Attribute

What is HTML <object> name Attribute

The HTML <object> name Attribute is used to specify the name of the embedded file. This attribute is also used as a reference for an object element in the Javascript.

Definition and Usage

The name attribute specifies the name of an <object> element.

The name attribute is used for referencing an <object> element in JavaScript (an alternative, is to reference it by using its id attribute).


Browser Support

Syntax

<object name="name">

Attribute Values

Value Description
name The name of the <object> element

How to add HTML <object> name Attribute

An <object> element with a name attribute.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The object name attribute</h1>

<object data="https://horje.com/avatar.png" name="obj1" width="300" height="200">
</object>
 
</body>
</html>

Output should be:

How to add HTML <object> name Attribute

What is HTML <object> type Attribute

The type attribute on an <object> tag specifies the media type of the embedded resource.

A media type indicates the format and nature of the resource.

Definition and Usage

The type attribute specifies the Internet media type of the object.


Browser Support

Syntax

<object type="media_type">

Attribute Values

Value Description
media_type The Internet media type of the embedded content.
Look at IANA Media Types for a complete list of standard media types.

How to add HTML <object> type Attribute

An <object> element with a specified media type.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The object type attribute</h1>

<object data="https://horje.com/avatar.png" type="image/jpg" width="500" height="300">
</object>
 
</body>
</html>

Output should be:

How to add HTML <object> type Attribute

What is <object> typemustmatch Attribute

This attribute is used in order to to make it safer for authors to embed untrusted resources where they expect a certain content type. The attribute specifies that the resource specified by the data attribute is only to be used if the value of the type attribute and the Content-Type of the aforementioned resource match.

The typemustmatch attribute must only be used when both the type and data is also being used.

The typemustmatch is a boolean attribute. If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace (i.e. either typemustmatch or typemustmatch="typemustmatch")..

 

typemustmatch true/false Specifies whether the type attribute and the actual content of the resource must match to be displayed

How to add <object> typemustmatch Attribute

See the example.

index.html
Example: HTML
<object data="https://cdn.bitdegree.org/learn/giphy%20(1).gif?raw=true" type="image/gif" width="550" height="450" typemustmatch></object>

Output should be:

How to add <object> typemustmatch Attribute

What is HTML <object> usemap Attribute

The useMap property on the HTMLImageElement interface reflects the value of the HTML usemap attribute, which is a string providing the name of the client-side image map to apply to the image.

Definition and Usage

The usemap attribute specifies the name of an image map to use with the object.

An image map is an image with clickable areas.

The usemap attribute is associated with a <map> element's name attribute, and creates a relationship between the object and the map.


Browser Support

Syntax

<object usemap="#mapname">

Attribute Values

Value Description
#mapname A hash character ("#") plus the name of the map element to use

How to add HTML <object> usemap Attribute

An <object> element using an image map:

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The object usemap attribute</h1>

<object data="https://horje.com/uploads/demo/2024-09-29-14-25-40-screenshot_2024-09-29_at_20-23-53_w3schools_online_html_editor.png" width="145" height="126" usemap="#planetmap"></object>

<map name="planetmap">
  <area shape="rect" coords="0,0,82,126" alt="Sun" href="sun.htm">
  <area shape="circle" coords="90,58,3" alt="Mercury" href="mercur.htm">
  <area shape="circle" coords="124,58,8" alt="Venus" href="venus.htm">
</map>

<p><b>Note:</b> The usemap attribute of the object element is not supported in Chrome, 
Edge, Safari, and Opera.</p>
 
</body>
</html>

Output should be:

How to add HTML <object> usemap Attribute

What is HTML <object> width Attribute

The HTML <object> width attribute is used to specify the horizontal dimension of the embedded object, defining the width of the displayed content within the webpage.

Definition and Usage

The width attribute specifies the width of the object, in pixels.


Browser Support

Syntax

<object width="pixels">

Attribute Values

Value Description
pixels The width of the object, in pixels (i.e. width="100")

How to add HTML <object> width Attribute

An embedded image with a height of 300 pixels and a width of 200 pixels.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The object element</h1>

<object data="https://horje.com/avatar.png" width="300" height="200"></object>
 
</body>
</html>

Output should be:

How to add HTML <object> width Attribute




html object

Related Articles
What is HTML <!--...--> Tag HTML Tag
What is HTML <!DOCTYPE> Declaration HTML Tag
What is HTML Elements and Doctypes HTML Tag
What is HTML <a> Tag HTML Tag
What is HTML <abbr> Tag HTML Tag
What is HTML <acronym> Tag HTML Tag
What is HTML <address> Tag HTML Tag
What is HTML <applet> Tag HTML Tag
What is HTML <area> Tag HTML Tag
What is HTML <article> Tag HTML Tag
What is HTML <aside> Tag HTML Tag
What is HTML <audio> Tag HTML Tag
What is HTML <b> Tag HTML Tag
What is HTML <base> Tag HTML Tag
What is HTML <basefont> Tag HTML Tag
What is HTML <bdi> Tag HTML Tag
What is HTML <bdo> Tag HTML Tag
What is HTML <big> Tag HTML Tag
What is HTML <blockquote> Tag HTML Tag
What is HTML <body> Tag HTML Tag
What is HTML <br> Tag HTML Tag
What is HTML <button> Tag HTML Tag
What is HTML <canvas> Tag HTML Tag
What is HTML <caption> Tag HTML Tag
What is HTML <center> Tag HTML Tag
What is HTML <cite> Tag HTML Tag
What is HTML <code> Tag HTML Tag
What is HTML <col> Tag HTML Tag
How to create HTML <colgroup> Tag HTML Tag
What is HTML <data> Tag HTML Tag
What is HTML <datalist> Tag HTML Tag
What is HTML <dd> Tag HTML Tag
What is HTML <del> Tag HTML Tag
What is HTML <details> Tag HTML Tag
What is HTML <dfn> Tag HTML Tag
What is HTML <dialog> Tag HTML Tag
What is HTML <dir> Tag HTML Tag
What is HTML <div> Tag HTML Tag
What is HTML <dl> Tag HTML Tag
What is HTML <dt> Tag HTML Tag
What is HTML <em> Tag HTML Tag
What is HTML <embed> Tag HTML Tag
What is HTML <fieldset> Tag HTML Tag
What is HTML <figcaption> Tag HTML Tag
What is HTML <figure> Tag HTML Tag
What is HTML <font> Tag HTML Tag
What is HTML <footer> Tag HTML Tag
What is HTML <form> Tag HTML Tag
What is HTML <frame> Tag HTML Tag
What is HTML <frameset> Tag HTML Tag
What is HTML <h1> to <h6> Tags HTML Tag
What is HTML <head> Tag HTML Tag
What is HTML <header> Tag HTML Tag
What is HTML <hgroup> Tag HTML Tag
What is HTML <hr> Tag HTML Tag
What is HTML <html> Tag HTML Tag
What is HTML <i> Tag HTML Tag
What is HTML <iframe> Tag HTML Tag
What is HTML <img> Tag HTML Tag
What is HTML <input> Tag HTML Tag
What is HTML <ins> Tag HTML Tag
What is HTML <kbd> Tag HTML Tag
What is HTML <label> Tag HTML Tag
What is HTML <legend> Tag HTML Tag
What is HTML <li> Tag HTML Tag
What is HTML <link> Tag HTML Tag
What is HTML <main> Tag HTML Tag
What is HTML <map> Tag HTML Tag
What is HTML <mark> Tag HTML Tag
What is HTML <menu> Tag HTML Tag
What is HTML <meta> Tag HTML Tag
What is HTML <meter> Tag HTML Tag
What is HTML <nav> Tag HTML Tag
What is HTML <noframes> Tag HTML Tag
What is HTML <noscript> Tag HTML Tag
What is HTML <object> Tag HTML Tag
What is HTML <ol> Tag HTML Tag
What is HTML <optgroup> Tag HTML Tag
What is HTML <option> Tag HTML Tag
What is HTML <output> Tag HTML Tag
What is HTML <p> Tag HTML Tag
What is HTML <param> Tag HTML Tag
What is HTML <picture> Tag HTML Tag
What is HTML <pre> Tag HTML Tag
What is HTML <progress> Tag HTML Tag
What is HTML <q> Tag HTML Tag
What is HTML <rp> Tag HTML Tag
What is HTML <rt> Tag HTML Tag
What is HTML <ruby> Tag HTML Tag
What is HTML <s> Tag HTML Tag
What is HTML <samp> Tag HTML Tag
What is HTML <script> Tag HTML Tag
What is HTML <search> Tag HTML Tag
What is HTML <section> Tag HTML Tag
What is HTML <select> Tag HTML Tag
What is HTML <small> Tag HTML Tag
What is HTML <source> Tag HTML Tag
What is HTML <span> Tag HTML Tag
What is HTML <strike> Tag HTML Tag
What is HTML <strong> Tag HTML Tag
What is HTML <style> Tag HTML Tag
What is HTML <sub> Tag HTML Tag
What is HTML <summary> Tag HTML Tag
What is HTML <sup> Tag HTML Tag
What is HTML <svg> Tag HTML Tag
What is HTML <table> Tag HTML Tag
What is HTML <tbody> Tag HTML Tag
What is HTML <td> Tag HTML Tag
What is HTML <template> Tag HTML Tag
What is HTML <textarea> Tag HTML Tag
What is HTML <tfoot> Tag HTML Tag
What is HTML <th> Tag HTML Tag
What is HTML <thead> Tag HTML Tag
What is HTML <time> Tag HTML Tag
What is HTML <title> Tag HTML Tag
What is HTML <tr> Tag HTML Tag
What is HTML <track> Tag HTML Tag
What is HTML <tt> Tag HTML Tag
What is HTML <u> Tag HTML Tag
What is HTML <ul> Tag HTML Tag
What is HTML <var> Tag HTML Tag
What is HTML <video> Tag HTML Tag
How to add HTML <wbr> Tag HTML Tag

Single Articles
How to create HTML <object> TagHTML Tag
How to create An embedded image on HTML <object> TagHTML Tag
How to create An embedded HTML page on HTML <object> TagHTML Tag
How to create An embedded video on HTML <object> TagHTML Tag
How to set Default CSS Settings on HTML <object> TagHTML Tag
What is HTML <object> data AttributeHTML Tag
How to create HTML <object> data AttributeHTML Tag
What is HTML <object> form AttributeHTML Tag
How to create HTML <object> form AttributeHTML Tag
What is HTML <object> height AttributeHTML Tag
How to add HTML <object> height AttributeHTML Tag
What is HTML <object> name AttributeHTML Tag
How to add HTML <object> name AttributeHTML Tag
What is HTML <object> type AttributeHTML Tag
How to add HTML <object> type AttributeHTML Tag
What is <object> typemustmatch AttributeHTML Tag
How to add <object> typemustmatch AttributeHTML Tag
What is HTML <object> usemap AttributeHTML Tag
How to add HTML <object> usemap AttributeHTML Tag
What is HTML <object> width AttributeHTML Tag
How to add HTML <object> width AttributeHTML Tag

Read Full:
HTML Tag
Type:
Develop
Category:
Web Tutorial
Sub Category:
HTML Tag
Uploaded by:
Admin
Views:
503


Reffered: https://www.w3schools.com/tags/tag_object.asp