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;

Try it yourself

Example 2

Set the type attribute of the link to text/html:

document.getElementById("myAnchor").type = "text/html";

Try it yourself

Syntax

Return the type attribute:

anchorObject.type

Set the type attribute:

anchorObject.type = MIME-type

Attributswert

Wert Beschreibung
MIME-type

Legt den MIME-Typ des verlinkten Dokuments fest.

Bitte sehen Sie nach IANA MIME-Typenum die vollständige Liste der Standard-MIME-Typen zu erhalten.

Technische Details

Rückgabewert: Zeichenkettenwert, der den MIME-Typ des verlinkten Dokuments angibt.

Browser-Unterstützung

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Unterstützung Unterstützung Unterstützung Unterstützung Unterstützung

Verwandte Seiten

HTML-Referenzhandbuch:HTML <a> type-Attribut