Easy Tutorial
❮ Prop Document Implementation Prop Track Label ❯

Link charset Attribute


Definition and Usage

The charset attribute sets or returns the character encoding of the linked document.

Syntax

Setting the charset attribute:

Returning the charset attribute:


Browser Support

All major browsers support the charset attribute.


Example

Display the character encoding of the linked document:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<link id="link1" href="domoarigato.htm" charset="ISO-2022-JP">
<script>
function displayResult(){
    var x=document.getElementById("link1").charset;
    alert(x);
}
</script>
</head>
<body>

<button type="button" onclick="displayResult()">Display the character set of the link element</button>

</body>
</html>

❮ Prop Document Implementation Prop Track Label ❯