HTMLAnchorElement: protocol プロパティ
HTMLAnchorElement.protocol プロパティは、 URL のプロトコルスキームを表す文字列で、最後の ':' を含みます。
値
文字列です。
例
アンカーリンクのプロトコルを取得
js
// <a id="myAnchor" href="https://developer.mozilla.org/en-US/HTMLAnchorElement"> 要素が文書にあったとします。
const anchor = document.getElementById("myAnchor");
anchor.protocol; // 'https:' を返す
仕様書
| Specification |
|---|
| HTML Standard # dom-hyperlink-protocol-dev |
ブラウザーの互換性
BCD tables only load in the browser
関連情報
- 所属先の
HTMLAnchorElementインターフェイス