HTMLLinkElement: sizes-Eigenschaft

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Die schreibgeschützte sizes-Eigenschaft der HTMLLinkElement-Schnittstellen definiert die Größen der Symbole für visuelle Medien, die in der Ressource enthalten sind. Sie spiegelt das sizes-Attribut des <link>-Elements wider, welches eine Liste von durch Leerzeichen getrennten Größen enthält. Jede Größe ist im Format <Breite in Pixel>x<Höhe in Pixel> oder als Schlüsselwort any angegeben.

Dies ist nur relevant, wenn der rel auf icon oder einen nicht standardmäßigen Typ wie apple-touch-icon gesetzt ist.

Wert

Beispiele

html
<link rel="icon" sizes="72x72 114x114" href="smallish.png" />
js
const link = document.querySelector("[rel=icon],[rel=apple-touch-icon]");
console.dir(link.sizes); /* output:
  DOMTokenList [ "72x72", "114x114" ]
    0: "72x72"
    1: "114x114"
    length: 2
    value: "72x72 114x114"
  */
console.log(link.sizes.value); // output: '72x72 114x114'
console.log(link.sizes.length); // output: 2'
console.log(link.sizes[0]); // output: '72x72'
console.log(link.sizes[1]); // output: '114x114'

Spezifikationen

Specification
HTML
# dom-link-sizes

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
sizes

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
See implementation notes.

Siehe auch