HTMLAnchorElement: username プロパティ
HTMLAnchorElement.username プロパティは、ドメイン名の前で指定されたユーザー名の入った文字列です。
値
文字列です。
例
アンカーリンクからユーザー名を取得
js
// <a id="myAnchor" href="https://anonymous:flabada@developer.mozilla.org/en-US/docs/HTMLAnchorElement"> 要素が文書にあったとします
const anchor = document.getElementByID("myAnchor");
anchor.username; // 'anonymous' を返す
仕様書
| Specification |
|---|
| HTML Standard # dom-hyperlink-username-dev |
ブラウザーの互換性
BCD tables only load in the browser
関連情報
- 所属先の
HTMLAnchorElementインターフェイス