HTML codetype Attribute
The obsolete HTML codetype attribute was historically used with the <object> element to specify the MIME type of the implementation identified by the classid attribute.
codetype attribute is obsolete and should not be used in modern HTML. Use modern HTML elements and their supported attributes to identify and embed content.
Historical Syntax
The codetype attribute was used with classid on an <object> element:
<object
classid="implementation-identifier"
codetype="application/example">
Alternative content
</object>
The classid value identified an implementation, while codetype supplied the MIME type of the code associated with that implementation.
Historical Elements
The codetype attribute was historically associated with the <object> element.
| Element | Historical Purpose |
|---|---|
<object> |
Specified the MIME type of the implementation identified by the classid attribute. |
Historical Use
The codetype attribute was part of an older system for embedding external objects and software components in webpages. It provided information about the type of code referenced through the classid attribute.
A browser could use the MIME type supplied by codetype to determine whether it supported the identified implementation before attempting to retrieve or initialize it.
This mechanism was associated with older browser plug-ins and component-based content. Its usefulness depended on technologies installed in or available to the user's browser and operating system.
Why It Became Obsolete
The codetype attribute became obsolete as browsers moved away from the plug-in and component systems that depended on attributes such as classid and codebase.
Modern HTML provides native elements for common types of media and embedded content. These elements use their own resource and type information rather than the old classid and codetype mechanism.
Modern Alternative
There is no direct modern replacement for the codetype attribute. The appropriate modern method depends on the type of resource being embedded.
When the modern <object> element is appropriate, its data attribute identifies the resource and its type attribute can specify the resource's MIME type:
<object data="document.pdf" type="application/pdf">
<p>Your browser cannot display the PDF document.</p>
</object>
The modern type attribute in this example describes the embedded resource. It should not be considered a direct replacement for codetype, which described the type of code associated with the obsolete classid mechanism.
For other content, use purpose-specific HTML elements such as <img>, <audio>, <video>, or <iframe> when appropriate.
Legacy Browser Support
The codetype attribute belonged to older object embedding systems and depended on browser support for the associated implementation and plug-in technology.
Modern browsers should not be expected to reproduce the legacy behavior associated with codetype, classid, or obsolete browser plug-ins. Existing content that depends on these mechanisms generally needs to be updated using current web technologies.
For additional information about historical browser compatibility, visit Can I Use? . Search for the HTML element or attribute you want to check. Search results can include related HTML features, element attributes, APIs, and other technologies, so select the result that most closely matches the legacy feature you are researching.
Related Attributes
Other obsolete HTML attributes historically associated with objects and embedded implementations include:
classid- Historically used to identify the implementation for an embedded object.codebase- Historically used to provide a base URL for resources associated with an embedded object.archive- Historically used to identify archives containing resources associated with an object or applet.declare- Historically used to declare an object without immediately instantiating it.standby- Historically used to provide a message while an object was loading.
Specifications
The codetype attribute is obsolete in modern HTML and should not be used for embedded content. See the WHATWG HTML Living Standard for information about obsolete and non-conforming features.
