X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

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

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook