HTMLSourceElement: thuộc tính type

Thuộc tính type của giao diện HTMLSourceElement là một chuỗi đại diện cho MIME type của tài nguyên phương tiện.

Nó phản ánh thuộc tính type của phần tử <source>.

Giá trị

Một chuỗi.

Ví dụ

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"

Thông số kỹ thuật

Thông số kỹ thuật
HTML
# dom-source-type

Tương thích trình duyệt

Xem thêm