THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Anchor type Property

Anchor Object Reference Anchor Object

Example

Return the MIME type of a specific link:

var x = document.getElementById("myAnchor").type;

The result of x will be:

text/html
Try it yourself »

Definition and Usage

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

Internet Explorer Firefox Opera Google Chrome Safari

The type property is supported in all major browsers.


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 Reference Anchor Object