HTMLSourceElement: type property
Thetype property of theHTMLSourceElement interface is a string representing theMIME type of the media resource.
It reflects thetype attribute of the<source> element.
In this article
Value
A string.
Examples
html
<video> <source 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
| Specification |
|---|
| HTML> # dom-source-type> |