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

View in English Always switch to English

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.

メモ: この機能はウェブワーカー内で利用可能です。

passwordURLPattern インターフェイスの読み取り専用プロパティで、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

ブラウザーの互換性