URLPattern: password プロパティ
Baseline
2025
Newly available
Since September 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
メモ: この機能はウェブワーカー内で利用可能です。
password は URLPattern インターフェイスの読み取り専用プロパティで、URL のパスワード部分と照合するパターンを含む文字列です。
この値は、コンストラクターに渡されたパスワードのパターンの正規化値、任意のパスワードに一致するデフォルト値 ("*") のどちらかです。
値
文字列です。
例
>基本的な使い方
下記の例では URLPattern オブジェクトを作成し、 correct-horse-battery{-staple}? を password 部分として指定しています。
このパターンは、パスワード correct-horse-battery および correct-horse-battery-staple と一致します。
js
const pattern = new URLPattern({ password: "correct-horse-battery{-staple}?" });
console.log(pattern.password); // 'correct-horse-battery{-staple}?'
console.log(pattern.test("https://user:correct-horse-battery@example.com")); // true
仕様書
| Specification |
|---|
| URL Pattern> # dom-urlpattern-password> |