HTMLLinkElement: media-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 media-Eigenschaft des HTMLLinkElement-Interfaces ist ein String, der eine Liste von einem oder mehreren Medienformaten darstellt, auf die die Ressource zutrifft.

Sie entspricht dem media-Attribut des <link>-Elements.

Wert

Ein String.

Beispiele

html
<link
  id="el"
  href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
  rel="stylesheet"
  media="screen and (min-width: 600px)"
  crossorigin="anonymous" />
js
const el = document.getElementById("el");
console.log(el.media); // Output: "screen and (min-width: 600px)"

Spezifikationen

Specification
HTML
# dom-link-media

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
media

Legend

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

Full support
Full support