HTMLSourceElement: type property

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{APIRef("HTML DOM")}}

The **type** property of the {{domxref("HTMLSourceElement")}} interface is a string representing the {{glossary("MIME type")}} of the media resource.

It reflects the type attribute of the {{HTMLElement("source")}} element.

Value

A string.

Examples

html
<video>
  <source
    id="el"
    src="large.webp"
    type="video/webp"
    media="screen and (width >= 600px)" />
</video>
js
const el = document.getElementById("el");
console.log(el.type); // Output: "video/webp"

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{domxref("HTMLSourceElement.src")}}
  • {{domxref("HTMLSourceElement.srcset")}}
  • {{domxref("HTMLSourceElement.media")}}
  • {{domxref("HTMLSourceElement.sizes")}}
  • {{htmlelement("source")}}
  • {{htmlelement("picture")}}
  • {{htmlelement("audio")}}
  • {{htmlelement("video")}}
  • Media types found on the web
  • Important MIME types for web developers
  • Media Capabilities API