Latest web development tutorials

HTML DOM Link charset attribute

Link Object Reference Link Objects

Definition and Usage

charset property sets or returns the character encoding of the linked document.

grammar

Set the charset attribute:

linkObject.charset="character-set"

Returns the charset attribute:

linkObject.charset


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support charset attribute


Examples

Examples

Display character encoding of the linked document:

<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ 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 ()"> to display the character set of the link element </ button>

</ Body>
</ Html>

try it"


Link Object Reference Link Objects