Javascript Reference - HTML DOM Link sizes Property








The read-only sizes property returns the sizes attribute of the linked resource.

The sizes attribute specifies the sizes of icon for visual media, and is only used if rel="icon".

Browser Support

Link sizes Yes No No No Yes

Syntax

var v = linkObject.sizes

Return Value

The size of the icon.





Example

The following code shows how to get the size of the linked icon.


<!DOCTYPE html>
<html>
<head>
<link id="myLink" rel="icon" href="demo_icon.gif" type="image/gif" sizes="16x16">
</head><!--from ww w  . j  a v  a2  s. co  m-->
<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>

The code above is rendered as follows: