Etiqueta <object> de HTML

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 Specify the URL of the resource to be used by the object.
form Form id Specify the form to which the object belongs.
height Píxeles Specify the height of the object.
name Name Specify the name of the object.
type Media type Specify the media type of the data specified in the data attribute.
typemustmatch true/false Specify whether the actual content of the resource must match the type attribute to be displayed.
usemap #mapname Define the name of the client image mapping to be used with the object.
width Píxeles Define el ancho del objeto.

Atributos globales

<object> La etiqueta también admite Atributos globales en HTML.

Atributos de eventos

<object> La etiqueta también admite Atributos de evento en HTML.

Configuración CSS predeterminada

La mayoría de los navegadores mostrarán el elemento <object> con los siguientes valores predeterminados:

object:focus {
  outline: none;
}

Compatibilidad con navegadores

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Soporte Soporte Soporte Soporte Soporte