Link typePropiedad
Objeto Link
Definición y uso
La propiedad type establece o devuelve el tipo (tipo MIME) del documento enlazado.
Consejo:Ejemplos de tipos MIME: "text/css", "text/javascript", "image/gif", etc.
Sintaxis
Establecer la propiedad type:
linkObject.type="MIME-type"
Devolver la propiedad type:
linkObject.type
Soporte del navegador
![]()
![]()
![]()
![]()
![]()
Todos los navegadores principales admiten la propiedad type.
Ejemplo
Ejemplo
Mostrar el tipo MIME del documento enlazado:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial para novatos (example.com)</title>
<link id="link1" rel="stylesheet" type="text/css" href="style1.css.html">
<script>
function displayResult(){
var x=document.getElementById("link1").type;
alert(x);
}
</script>
</head>
<body>
<button type="button" onclick="displayResult()">Mostrar el tipo MIME del elemento de enlace</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial para novatos (example.com)</title>
<link id="link1" rel="stylesheet" type="text/css" href="style1.css.html">
<script>
function displayResult(){
var x=document.getElementById("link1").type;
alert(x);
}
</script>
</head>
<body>
<button type="button" onclick="displayResult()">Mostrar el tipo MIME del elemento de enlace</button>
</body>
</html>
Pruébalo »
Objeto Link Otras extensiones