Use XHTML's object element to embed images,
multimedia objects, and applets
(applications that are intended to be displayed in a
rectangular area of your document). The object element is an inline element.
Here is the content model:
element object
{ attribute classid { xsd:anyURI }?,
attribute codebase { xsd:anyURI }?,
attribute data { xsd: anyURI }?,
attribute type { text }?,
attribute codetype { text }?,
attribute standby { text }?,
attribute declare { "declare" }?,
attribute height { text }?,
attribute width { text }?,
attribute name { text }?,
attribute tabindex { xsd:nonNegativeInteger }?,
Common.attrib,
param*,
Flow.model
}
classid
This URI points to an application to be run. The application will supply the content to be displayed in the document.
codebase
If supplied, this attribute gives the base URI used to
expand any relative URI references in the classid and data attributes.
data
If your application needs to know where its data lives, you can supply the URI of that data in this attribute.
type
Use this attribute to specify the MIME type of the
data specified by the data attribute.
See Section 6.7, “MIME types: Defining a resource's format”.
codetype
Use this attribute to specify the MIME type of the
application specified in the classid
attribute. See Section 6.7, “MIME types: Defining a resource's format”.
standby
If you think your application might take more than a
fraction of a second to load, you may want to set the
standby attribute to some text that
will be displayed while your application is loading.
For example: standby="Loading...".
declare="declare"
Normally, the browser will execute your application
as soon as your page is loaded. However, if you
use the declare="declare" attribute,
the browser will remember the id of
the object and defer execution until some other
object refers to that id later. See
Section 13.2, “How to delay instantiation of an object”.
height, width
You can override the inherent dimensions of the object by supplying the height and width of the object's area in these attributes. These attributes are deprecated. Use CSS instead; see Section 5, “Separating content and presentation with CSS”.
name
If this object is part of a form, use the name attribute to give a “control
name” to the object on the form. See Section 14, “Forms: The form element”.
tabindex
You can use this attribute to specify when the object
will get focus when the user uses the tab key. See Section 15.7, “The tabindex attribute: Specifying
tab traversal order”.
Common.attrib
You can use any of the attributes from Section 15.3, “The common attributes: Common.attrib”.
param*
You can pass arguments to the application by
supplying one or more param elements.
See Section 13.1, “The param element: Passing arguments
to applications”.
Flow.model
The content of an object element can be
any mixture of text, inline objects, and block
objects. See Section 12, “Flow.model: Arbitrary content”.
For a single, static object such as a GIF image, simply use
a classid attribute that points to the
image. For blind readers, supply some plain text content
inside the element that will be displayed when images can't
be rendered. Here's an example:
<object data="grundoon.png" type="image/png">
A drawing of Grundoon Groundchuck.
</object>
In general, the content of an object
will often be another object element.
The rule here is that the browser will try to render
the outer object first; if that fails,
it will render the content.
When you are including embedded applications in your Web
page, keep in mind that not all applications will work in
all environments. Hence, it is good practice to use a
nested series of object elements, with each
inner element more likely to render correctly. Here's an
example: the browser will try first to run the Python
application zoot.py. If it can't do
that, it tries to display an animation in MPEG format. If
that isn't possible either, it tries to display a PNG
image. Finally, if even displaying an image is impossible
(as for a blind reader), it displays the text “A
picture of Zoot”.
<object classid="http://www.anthrax.edu/cgi-bin/zoot.py">
<object data="zoot.mpeg" type="application/mpeg">
<object data="zoot.png" type="image/png" >
A picture of Zoot.
</object>
</object>
</object>
The purpose of the param element is to
pass parameter values to an object
element. This is necessary only when the object is a
script that expects those values to be supplied to it.
Any number of named values may be passed to the object,
one in each param element.
Here is the content model:
element param
{ attribute name { text },
attribute value { text }?,
attribute valuetype { 'data' | 'ref' | 'object' }?,
attribute type { text }?,
attribute id { xsd:ID }?,
empty
}
name
Set this attribute to the name of the parameter you want to pass to the object.
value
Use this attribute for the value that you are passing to the object.
valuetype
This attribute specifies what kind of value you are passing. It must be one of these:
data |
The value attribute is a
string that will be passed to the
application.
|
ref |
The value is a URI to be
passed to the application as a string.
|
object |
Use this form to pass a reference to an
|
type
When you use valuetype='ref', set
the type attribute to the MIME type
of the resource at the URI specified by the value attribute. See Section 6.7, “MIME types: Defining a resource's format” for permissible values.
id
Use this attribute to attach a unique identifier to the object. This is required when you are passing an object to an object: see Section 13.2, “How to delay instantiation of an object”.
empty
No content is allowed in a param element.
Here's an example. Suppose you have a map-viewer applet
named mapview.py that displays a
topographic map. Further suppose that it is expecting a
variable named start-quad to contain the
name of the map where it starts. This example would pass
the string “Water Canyon, NM” to the
applet:
<object classid="mapview.py">
<param name='start-quad' value='Water Canyon, NM'/>
[text to be displayed if the map viewer cannot be rendered]
</object>