HTML typemustmatch Attribute

Beginner
4 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

typemustmatch was a boolean attribute on <object>. The idea was: only use the resource if its HTTP Content-Type matched the element’s type attribute — a MIME “must match” check.

It never gained wide browser support, was dropped from the living HTML Standard (around 2019), and is listed as obsolete. Spec advice today: avoid embedding untrusted resources with <object> — do not rely on typemustmatch.

Deprecated / obsolete.

Do not use typemustmatch in new pages. Learn it only to recognize old markup and migrate to modern embeds.

HTML Syntax

syntax.html
<!-- obsolete --> <object data="…" type="…" typemustmatch>

Modern form: omit typemustmatch. Use <object data="…" type="…"> only when you need object, with trusted URLs and fallback content.

Attribute Values

Boolean attribute (presence = true). For study only:

Value / formDescriptionTry it
typemustmatchPresent → intended “MIME must match type” (obsolete)Try it
typemustmatch=""Same as presence for boolean attributesTry it
(omit)Correct today — never add this attributeTry it
Use data + typeValid object attributes; not a substitute for trustTry it
Prefer other embedsimg, video, iframe, embed when they fitTry it

Live Preview

Compare obsolete markup with the modern form. Prefer the modern snippet in real projects.

markup style

Study only — typemustmatch is non-conforming and unused by engines.

Snippet
<!-- obsolete — do not use -->
<object data="/video/count.mp4" type="video/mp4" typemustmatch>
  Fallback content
</object>

Obsolete boolean present — browsers do not rely on this check.

HTML Examples

Study snippets. Use Try It Yourself for a live editor. Prefer modern patterns in production.

Example 1 — Recognize Obsolete Markup

Old docs sometimes showed typemustmatch next to type. Do not copy this into new work.

HTML
<!-- Obsolete — for study only -->
<object
  data="/video/count.mp4"
  type="video/mp4"
  typemustmatch
  width="400"
  height="225">
  <p>Your browser cannot display this object.
    <a href="/video/count.mp4">Download the video</a>.
  </p>
</object>
Try It Yourself

How It Works

  1. Old intent — only activate the object if MIME matched type.
  2. Boolean flag — presence meant “strict match required.”
  3. Never portable — engines did not implement it consistently.
  4. Action — delete the attribute when you find it.

Example 2 — Modern <object> (No typemustmatch)

Use data and type, plus fallback content. Only embed trusted URLs.

HTML
<object
  data="/video/count.mp4"
  type="video/mp4"
  width="400"
  height="225">
  <p>
    Cannot display the media.
    <a href="/video/count.mp4">Open the file</a>.
  </p>
</object>
Try It Yourself

How It Works

  1. data — URL of the resource.
  2. type — MIME hint (still valid; not the same as typemustmatch).
  3. Children — fallback if the resource cannot be shown.
  4. Trust — security comes from what you embed, not from an obsolete flag.

Example 3 — Prefer Purpose-Built Elements

For video, use <video> instead of fighting with object MIME flags.

HTML
<video width="400" height="225" controls>
  <source src="/video/count.mp4" type="video/mp4">
  Your browser does not support HTML video.
</video>
Try It Yourself

How It Works

  1. Match the media — video → video, images → img, pages → iframe.
  2. type on <source> — MIME hint for the browser’s format choice.
  3. No obsolete flags — modern elements already know how to load media.
  4. Keep studying object only when a plugin-style or PDF embed truly needs it.

Edge Cases & Pitfalls

Most confusion is treating this as a live security feature or mixing it up with type.

obsolete

Authors must not use it

WHATWG lists typemustmatch as obsolete. Spec replacement advice: avoid untrusted object resources.

vs type

type is still valid

type on object remains a content-type hint. typemustmatch was a separate boolean that never stuck.

security

Not a substitute for trust

Even historically, MIME matching was not enough. Do not embed untrusted URLs; use CSP and purpose-built elements.

support

Never Baseline

Lack of interoperable implementation is why the feature was removed from the standard and from MDN docs.

migrate

Search and delete

If legacy HTML still has typemustmatch, remove it. Behavior should not depend on it.

Browser Support

typemustmatch is an obsolete HTML attribute on <object>. It was never widely implemented and is non-conforming for authors.

✓ Obsolete · Do not use

typemustmatch

Removed from the living HTML Standard. Do not expect engines to enforce MIME matching via this attribute. Prefer trusted embeds and modern elements.

0% Author use (do not)
Google Chrome No usable support
Do not use
Mozilla Firefox No usable support
Do not use
Apple Safari No usable support
Do not use
Microsoft Edge No usable support
Do not use
Opera No usable support
Do not use
Samsung Internet No usable support
Do not use
Internet Explorer No usable support
Do not use
typemustmatch Obsolete

Bottom line: Study only. Delete typemustmatch from legacy pages; use object data/type carefully, or switch to video, img, iframe, or embed.

Key Takeaways

  • Status: obsolete — authors must not use it.
  • Old idea: force MIME of the resource to match type.
  • Keep: data + type on trusted object embeds.
  • Prefer: video, img, iframe, embed when they fit.

One line: typemustmatch was an unused MIME-guard on <object> — obsolete; delete it and embed only trusted resources with modern elements.

Frequently Asked Questions

A boolean attribute on <object> that was meant to require the resource’s Content-Type to match the type attribute before the object was used. It is obsolete and must not be used in new pages.
No. The WHATWG HTML Standard lists it as obsolete. It never got wide browser support and was removed from the living standard around 2019.
Use object with data and type only when you need object. Prefer modern embeds (img, video, iframe, embed) for common media. For untrusted content, do not rely on typemustmatch — avoid embedding untrusted resources.
No. type on object is still a valid MIME hint for the resource. typemustmatch was a separate boolean that tried to enforce a strict match — and is gone from the standard.
Do not depend on it. It was never implemented across browsers. Treat it as a historical footnote when reading old markup.
It is obsolete / non-conforming. Authors must not use it. MDN no longer documents it as a supported feature.

Next: usemap

Link an image to a client-side image map.

usemap tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful