Firefox Tomorrow

web api instance property

HTMLSourceElement: media property

View on MDN ↗

The media property of the HTMLSourceElement interface is a string representing the intended destination medium for the resource. The value is a media query, which is a comma separated list of media-types, media-features, and logical operators.

It reflects the media attribute of the <source> element.

Value

A string.

Examples

<video>
  <source
    id="el"
    src="/firefox/mdn-asset-missing.svg"
    type="video/quicktime"
    media="screen and (width >= 600px)" />
</video>
const el = document.getElementById("el");
console.log(el.media); // Output: "screen and (width >= 600px)"
el.media = "(width >= 800px)"; // Updates the media value

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also