You are currently using a web browser that does not support HTML 5 with style sheets. Please try the standard HTML 5, XHTML 1 or XHTML 1 Mobile version of this page instead.

The <object> Tag

The <object> tag in HTML 5

Converting to HTML 5

We are working on converting to HTML 5. Please visit HTML <object> Tag on the HTML 5 standard version of this site.

<object> Tag Syntax

Syntax of the <object> tag

Attributes of the <object> Tag

Attributes of the <object> tag

attribute
The attribute
common attributes
In addition to the attributes above, which are specific to the <object> tag, any of the common HTML attributes can also be used.
HTML 5 Examples

Examples of the object tag in HTML 5


Embedded Video

Example of embedding video in HTML 5

When embedding video from another site, such as YouTube, in an HTML 5 page the <object> tag is typically used rather than the <video> tag:

<object width="1280" height="745">
<param name="movie" value="http://www.YouTube.com/v/ZXYVyrrUZ3c&hl=en_US&fs=1&rel=0&hd=1"/>
<param name="allowFullScreen" value="true"/>
<param name="allowscriptaccess" value="always"/>
<embed src="http://www.YouTube.com/v/ZXYVyrrUZ3c&hl=en_US&fs=1&rel=0&hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="1280" height="745"/>
</object>

Demo of embedded YouTube video:
embedded YouTube video
(Note that this video will probably not play if your current browser does not yet support HTML 5 video.)

Object as Fallback

The <object> tag can be combined with some other tags, such as the <video> tag <audio> tag to provide a fallback when the browser does not support the type of media provided. The <object> element for fallback media is coded within the <audio> or <video> tag as shown in the following example, which falls back to an embedded YouTube video:

<video poster="poster.png" controls="controls" style="border: black 1px solid; margin: 4px">
<source src="http://Vyd.com/video.ogv" type="video/ogg; codecs="theora,vorbis""/>
<source src="http://Vyd.com/video.mp4" type="video/mp4; codecs="avc1.42E01E,mp4a.40.2""/>
<object width="1280" height="745">
<param name="movie" value="http://www.YouTube.com/v/ZXYVyrrUZ3c&hl=en_US&fs=1&rel=0&hd=1"/>
<param name="allowFullScreen" value="true"/>
<param name="allowscriptaccess" value="always"/>
<embed src="http://www.YouTube.com/v/ZXYVyrrUZ3c&hl=en_US&fs=1&rel=0&hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="1280" height="745"/>
</object>
</video>
Changes in HTML 5

What's new in HTML 5

Differences between HTML 5 and earlier versions

The following attributes should not be coded on the <object> tag because they either have been deprecated or were never officially supported:

  • align
  • border
  • hspace
  • vspace

Last updated Sunday September 19, 2010


Printer-friendly PDF* format:

HTML <object> Tag

You are currently viewing this page in HTML 5 Style Sheet* format (* see Clicklets for more infomation). This document is also available in HTML 5 XML*HTML 5 non-XML*XHTML 1 Style Sheet*XHTML 1*XML* HTML 4* XHTML Mobile* WML Mobile* and printer-friendly PDF* formats. This is accomplished with Single Source Publishing, a content management system that uses templates in XSLT style sheets provided by XML Styles .com to transform the source content for various content delivery channels. There is also RDF* metadata that describes the content of this document.