HTMLAnchorElement: thuộc tính type

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.

Thuộc tính type của giao diện HTMLAnchorElement là một chuỗi cho biết kiểu MIME của tài nguyên được liên kết.

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

Giá trị

Một chuỗi.

Ví dụ

html
<a id="exampleLink" href="https://example.com" type="text/html">Ví dụ liên kết</a>
<p class="type"></p>
css
#exampleLink {
  font-size: 1.5rem;
}
js
const anchorElement = document.getElementById("exampleLink");
const pTag = document.querySelector(".type");
console.log(anchorElement.type); // Xuất ra: "text/html"
pTag.textContent = anchorElement.type;

Đặc tả kỹ thuật

Specification
HTML
# dom-a-type

Trình duyệt hỗ trợ

Xem thêm