URLPattern: protocol プロパティ
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.
Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。
メモ: この機能はウェブワーカー内で利用可能です。
protocol は URLPattern インターフェイスの読み取り専用プロパティで、URL のプロトコル部分と照合するパターンを含む文字列です。
この値は、正規化が行われるため、コンストラクターへの入力と異なる場合があります。
値
文字列です。
例
下記の例では URLPattern オブジェクトを作成し、
http{s}? を protocol 部分として指定しています。このパターンは、 http および https プロトコルと一致します。
js
const pattern = new URLPattern({ protocol: "http{s}?" });
console.log(pattern.protocol); // 'http{s}?'
仕様書
| Specification |
|---|
| URL Pattern> # dom-urlpattern-protocol> |
ブラウザーの互換性
Loading…