Anchor type attribute
Definition and Usage
type
The attribute sets or returns the MIME type of the link type attribute Value.
type
The attribute specifies the MIME type of the linked document.
Tip:type
The attribute is purely advisory.
Note:type attribute It is a new attribute of the <a> element in HTML5.
Example
Example 1
Return the MIME type of a specific link:
var x = document.getElementById("myAnchor").type;
Example 2
Set the type attribute of the link to text/html:
document.getElementById("myAnchor").type = "text/html";
Syntax
Return the type attribute:
anchorObject.type
Set the type attribute:
anchorObject.type = MIME-type
Attribute Value
Value | Description |
---|---|
MIME-type |
Specifies the MIME type of the linked document. Please see IANA MIME Types, to get the complete list of standard MIME types. |
Technical Details
Return Value: | A string value representing the MIME type of the linked document. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
Related Pages
HTML Reference Manual:HTML <a> type Attribute