HTML <object> etikett

Definition and usage

<object> The tag defines a container for external resources.

External resources can be web pages, images, media players, or plugin applications.

To embed an image, it is best to use <img> tag.

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

To embed video or audio, it is best to use <video> And <audio> Tag.

See also:

HTML tutorial:HTML Object element

HTML DOM reference manual:Object object

Plugins

<object> Tags were originally designed to embed browser plugins.

Plugins are computer programs that extend the standard features of the browser.

Plugins have many different uses:

  • Run Java applet
  • Run ActiveX control
  • Display Flash movie
  • Display map
  • Scan for viruses
  • Verify bank ID

Warning !

Most browsers no longer support Java applets and plugins.

No browser supports ActiveX controls anymore.

Modern browsers have also stopped supporting Shockwave Flash.

Instance

Example 1

Embedded image:

<object data="tulip.jpg" width="300" height="300"></object>

Try it yourself

Example 2

Embedded HTML page:

<object data="/index.html" width="500" height="300"></object>

Try it yourself

Example 3

Embedded video:

<object data="shanghai.mp4" width="640" height="300"></object>

Try it yourself

Attribute

Attribute Value Description
data URL Definition of the URL of the resource to be used by the object.
form Form id Definition of the form to which the object belongs.
height Pixels Definition of the height of the object.
name Name Definition of the name of the object.
type Media type Definition of the media type of the data specified in the data attribute.
typemustmatch true/false Definition of whether the actual content of the resource must match the type attribute to be displayed.
usemap #mapname Definition of the name of the client image mapping to be used with the object.
width Pixels Bestämmer objektets bredd.

Globala egenskaper

<object> Etiketten stöder också Globala egenskaper i HTML.

händelseegenskaper

<object> Etiketten stöder också Händelseegenskaper i HTML.

Standard CSS-inställningar

De flesta webbläsare kommer att använda följande standardvärden för att visa <object>-elementet:

object:focus {
  outline: none;
}

Webbläsarstöd

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Stöd Stöd Stöd Stöd Stöd