HTMLLinkElement: type 屬性

Baseline 已廣泛支援

此特性已相當成熟,可在許多裝置和瀏覽器版本上使用。自 ⁨2015 年 7 月⁩以來,各瀏覽器均已提供此特性。

HTMLLinkElement 介面的 type 屬性是一個字串,表示連結資源的 MIME 型別

它反映了 <link> 元素的 type 屬性。

一個字串,必須是有效的 MIME 型別字串。

示例

html
<link
  id="el"
  rel="apple-touch-icon"
  sizes="114x114"
  href="apple-icon-114.png"
  type="image/png" />
js
const el = document.getElementById("el");
console.log(el.type); // Output: "image/png"

規範

規範
HTML
# dom-link-type

瀏覽器相容性