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

View in English Always switch to English

HTMLAnchorElement: type プロパティ

Baseline 広く利用可能

この機能は広く実装されており、多くのバージョンの端末やブラウザーで動作します。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;

仕様書

仕様書
HTML
# dom-a-type

ブラウザーの互換性

関連情報