URLPattern: password 屬性
注意:此功能在 Web Workers 中可用。
URLPattern 介面的 password 只讀屬性是一個字串,其中包含用於匹配 URL 密碼部分的模式。
值
字串。
示例
基本用法
以下示例建立一個 URLPattern 物件,其 password 部分為 correct-horse-battery{-staple}?,並記錄該屬性。此模式匹配密碼 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
規範
| 規範 |
|---|
| URL 模式 # dom-urlpattern-password |
瀏覽器相容性
載入中…