Latest web development tutorials

HTML DOM Link type property

Link Object Reference Link Objects

Definition and Usage

type property sets or return type (MIME type) of the linked document.

Tip: MIME-types Examples: "text / css", " text / javascript", "image / gif", and so on.

grammar

Setting type attributes:

linkObject.type="MIME-type"

Returns type attributes:

linkObject.type


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support attribute type


Examples

Examples

Display linked documents MIME-type:

<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Link id = "link1" rel = "stylesheet" type = "text / css" href = "style1.css">
<Script>
function displayResult () {
var x = document.getElementById ( "link1") type.;
alert (x);
}
</ Script>
</ Head>
<Body>

<Button type = "button" onclick = "displayResult ()"> to display the MIME type of the link element </ button>

</ Body>
</ Html>

try it"


Link Object Reference Link Objects