The codetype attribute on <object> gave the MIME content type of the code pointed to by classid (plugin / ActiveX / applet era). It is not an attribute of the inline <code> element.
For new pages, use data plus type on <object>, or native embeds such as <iframe>, <embed>, and media elements.
Obsolete.
Do not use codetype in new HTML. The Living Standard lists it with classid, code, codebase, and archive on <object> — learn it to read legacy markup only.
Change codetype on a demo <object>. Modern browsers ignore plugin loading and show the fallback text.
Study-only markup. Plugins do not run; fallback content is what users see.
object demo
codetype="application/java"
Code
HTML Examples
Short study snippets. Use Try It Yourself for a live editor. Prefer example 3 for new work.
Example 1 — Legacy object with classid
Historical pattern: classid names the implementation; codetype states its MIME type.
HTML
<object
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
codetype="application/x-java-applet"
width="300"
height="200">
Java plugin is not available. Use a modern browser and native HTML instead.
</object>
classid pointed at a COM/plugin implementation (often a clsid: URI).
codetype told the browser the MIME type of that code (here, a Java applet).
Fallback content inside <object> shows when the plugin cannot run.
Obsolete today. Keep this only to understand old pages — do not ship it.
Example 2 — codetype vs type
codetype goes with classid. type goes with data. They answer different questions.
HTML
<!-- Legacy: MIME of the classid code -->
<object
classid="clsid:Example-ID"
codetype="application/x-shockwave-flash"
width="200"
height="100">
Flash is not supported.
</object>
<!-- Modern idea: MIME of the data resource -->
<object
data="sample.pdf"
type="application/pdf"
width="200"
height="100">
<a href="sample.pdf">Download the PDF</a>
</object>
If the file URL is missing, fallback content (or an empty box) appears — that is expected in this demo.
How It Works
data is the resource URL (required in practice with type, or either alone per MDN).
type is the MIME type of that resource — the modern stand-in for what codetype tried to do for plugins.
Fallback stays inside <object> for accessibility when the resource fails.
Prefer native tags when they fit: <video>, <iframe>, <img>, etc.
Edge Cases & Pitfalls
Most mistakes mix up plugin MIME attributes with modern type, or confuse codetype with <code>.
obsolete
Not for new projects
Validators and the HTML Standard flag codetype. Remove it when updating legacy templates.
naming
Not the <code> element
codetype never styled or typed inline code. Use <code> for snippets; use type on media/scripts when needed.
pairing
Goes with classid, not data
It described the content type of data specified by classid. For a URL resource, use type with data.
param
Need a “codetype” parameter?
The Standard says: if you need a parameter named codetype, use a <param> child — not the obsolete attribute.
plugins
No plugin runtime anymore
Flash, Java applets, and ActiveX are gone from mainstream browsers. Expect fallback content only.
Compatibility
Browser Support
codetype is an obsolete HTML attribute on <object>. Engines may still expose it in the DOM for compatibility, but plugin behavior is gone.
✓ Obsolete · Do not use
codetype
Recognized historically with classid for plugins. Modern Chrome, Firefox, Safari, and Edge do not run those plugins — use data and type (or native embeds) instead.
LegacyCompatibility only
Google ChromeAttribute may exist; no plugins
Obsolete*
Mozilla FirefoxAttribute may exist; no plugins
Obsolete*
Apple SafariAttribute may exist; no plugins
Obsolete*
Microsoft EdgeAttribute may exist; no plugins
Obsolete*
OperaAttribute may exist; no plugins
Obsolete*
Samsung InternetAttribute may exist; no plugins
Obsolete*
Internet ExplorerLegacy ActiveX / plugins era
Legacy*
codetypeObsolete (ignored for plugins)
Bottom line: *Do not use in new pages. Migrate to data + type, iframe, embed, or media elements.
Remember
Key Takeaways
Role: MIME type of classid code on legacy <object>.
Status: obsolete — study for old markup only.
vs type:codetype → classid code; type → data resource.
Replace with:data + type, or native embed elements.
One line:codetype was plugin MIME for classid — ship data + type instead.
Frequently Asked Questions
On object (and historically applet), codetype gave the MIME content type of the code referenced by classid, so the browser could pick a plugin. It does not apply to the inline code element.
Obsolete. The HTML Living Standard lists codetype on object as obsolete. Authors must not use it. Prefer data and type on object, or iframe, embed, video, and other native embeds.
codetype described the MIME type of classid code. type describes the MIME type of the resource in data. Modern pages use type with data, not codetype with classid.
Primarily object. Older tutorials also show it on applet. It is not valid on code, script, or embed.
No. NPAPI plugins, Java applets, and ActiveX are gone from mainstream browsers. You will usually see only the object’s fallback content.
Use object with data and type, or iframe, embed, video, audio, or img depending on the resource. If you need a parameter literally named codetype, use a param child element.