Anchor type Property
Example
Return the MIME type of a specific link:
var x =
document.getElementById("myAnchor").type;
Try it Yourself »
Description
The type property sets or returns the value of the type attribute of a link.
The type attribute specifies the MIME type of the target URL in the area.
Note: The type attribute is purely advisory.
Note: The type attribute is new for the <a> element in HTML5.
Browser Support
| Property | |||||
|---|---|---|---|---|---|
| type | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the type property:
anchorObject.type
Set the type property:
anchorObject.type = MIME-type
Property Values
| Value | Description |
|---|---|
| MIME-type | Specifies the MIME type of the linked document. Look at IANA MIME types for a complete list of standard MIME types. |
Technical Details
| Return Value: | A String, representing the MIME type of the linked document |
|---|
More Examples
Example
Set the type attribute of a link to text/html:
document.getElementById("myAnchor").type = "text/html";
Try it Yourself »
Related Pages
HTML reference: HTML <a> type attribute
❮ Anchor Object
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.