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 July 2015.

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

文字列です。

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

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

仕様書

Specification
HTML
# dom-hyperlink-protocol-dev

ブラウザーの互換性

関連情報