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

View in English Always switch to English

HTMLAnchorElement: protocol プロパティ

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月⁩.

HTMLAnchorElement.protocol プロパティは、 URL のプロトコルスキームを表す文字列で、最後の ':' を含みます。

文字列です。

アンカーリンクのプロトコルを取得

js
// <a id="myAnchor" href="https://developer.mozilla.org/ja/HTMLAnchorElement"> 要素が文書にあったとします。
const anchor = document.getElementById("myAnchor");
anchor.protocol; // 'https:' を返す

仕様書

Specification
HTML
# dom-hyperlink-protocol-dev

ブラウザーの互換性

関連情報