Link sizes Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Link

Description

The sizes property returns the sizes attribute of the linked resource, which identifies the sizes of icon for visual media, and is only used if rel="icon".

This property is read-only.

Return Value

The size of the icon

The following code shows how to return the size of the linked icon:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<link id="myLink" rel="icon" href="demo_icon.gif" type="image/gif" sizes="16x16">
</head>//w  w  w  . jav a  2  s.c  om
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myLink").sizes;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials