Skip to main content

HTML Guide

Element “object” is missing one or more of the following attributes: “data”, “type”.

<object> elements require both the data and type attributes to be valid according to W3C HTML specifications.

The <object> element is used to embed external resources, such as images, videos, PDFs, or other media—often for plugins or fallback content. The data attribute specifies the resource URL, while the type attribute describes its MIME type (such as "image/svg+xml" for SVG images, or "application/pdf" for PDFs). Supplying both attributes allows browsers and assistive technologies to correctly interpret and display the embedded content, ensuring accessibility and standards compliance.

Correct usage example:

<object data="example.pdf" type="application/pdf" width="600" height="400">
  <p>Your browser does not support PDFs. <a href="example.pdf">Download the PDF</a>.</p>
</object>

Incorrect usage examples (missing attributes):

<!-- Missing type attribute -->
<object data="example.svg"></object>
<!-- Missing data attribute -->
<object type="image/svg+xml"></object>

Corrected example for embedding SVG:

<object data="image.svg" type="image/svg+xml"></object>

To fix validator errors, always include both the data and type attributes in <object>.

Learn more:

Related W3C validator issues