Specifying data and type
To get a basic idea of how the object element works, take a look at this
minimal markup example that uses the object element to place an inline
image.
<object data="daffodil.gif"type="image/gif">A color photograph of a daffodil.</object>
Here, the data attribute
provides the URL for the source for the embedded object (in this case
an image file) and type tells the
browser that the content type is a GIF image. When a type attribute is provided, the browser uses
that information to determine how (and if) to render the object. The
browser’s preferences contain a list that specifies how to handle each
content type, be it via native support, a plug-in player, or an
external helper application. If the type is not recognized, the
browser may not be able to render the object. In this example, the
browser can render a GIF image without the need of a special
player.
Warning
While the syntax exists for adding images with the object element, the img element is still the most common way
to go due to lack of browser support of object for image placement.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access