このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

HTMLAnchorElement: type プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2015年7月⁩.

typeHTMLAnchorElement インターフェイスのプロパティで、リンク先のリソースの MIME タイプを示す文字列です。

これは <a> 要素の type プロパティを反映します。

文字列です。

html
<a id="exampleLink" href="https://example.com" type="text/html">Example Link</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); // Output: "text/html"
pTag.textContent = anchorElement.type;

仕様書

Specification
HTML
# dom-a-type

ブラウザーの互換性

関連情報