Propiedad de tipo de ancla

Definición y uso

type La propiedad establece o devuelve el tipo MIME del enlace Propiedad type Valor.

type La propiedad especifica el tipo MIME del documento enlazado.

Consejo:type La propiedad es puramente sugerente.

Notas:Propiedad type Es una nueva propiedad del elemento <a> en HTML5.

Ejemplo

Ejemplo 1

Devolver el tipo MIME específico del enlace:

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

Prueba personal

Ejemplo 2

Establecer la propiedad type del enlace a text/html:

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

Prueba personal

Sintaxis

Devolver la propiedad type:

anchorObject.type

Establecer la propiedad type:

anchorObject.type = MIME-type

Valor del atributo

Valor Descripción
MIME-type

Define el tipo MIME del documento de enlace.

Consulte Tipos MIME de IANA, para obtener una lista completa de los tipos MIME estándar.

Detalles técnicos

Valor de retorno: Valor de cadena que indica el tipo MIME del documento de enlace.

Compatibilidad del navegador

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Soporte Soporte Soporte Soporte Soporte

Páginas relacionadas

Manual de referencia de HTML:Atributo type del HTML <a>