coderef

URLPatternBaseline · Newly available

The URLPattern API creates patterns that can be matched against URLs or URL components.

Works in the latest version of every major browser, but older devices may not support it yet. Baseline since Sep 15, 2025.

Browser support

DesktopChrome
1–94Not supported
95+Supportedsince Oct 19, 2021
Current: 155
Edge
12–94Not supported
95+Supportedsince Oct 21, 2021
Current: 154
Firefox
1–141Not supported
142+Supportedsince Aug 19, 2025
Current: 157
Safari
1–18.6Not supported
26+Supportedsince Sep 15, 2025
Current: 27
MobileChrome Android
18–94Not supported
95+Supportedsince Oct 19, 2021
Current: 155
Firefox Android
4–141Not supported
142+Supportedsince Aug 19, 2025
Current: 157
Safari iOS
1–18.6Not supported
26+Supportedsince Sep 15, 2025
Current: 27

How to use

Every current browser supports this, but it only became Baseline on Sep 15, 2025. Use it as a progressive enhancement, or keep a fallback if you support older devices.

Example

Full syntax and examples are on MDN: URLPattern.

Feature detection

JS · check before using
if ("URLPattern" in globalThis) {
  // URLPattern is available
} else {
  // load a polyfill or use a fallback
}

Sub-features

Support for each part of the feature (14). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
URLPattern9595142269514226
URLPattern.URLPattern9595142269514226
URLPattern.URLPattern.ignoreCase_option1071071422610714226
URLPattern.exec9595142269514226
URLPattern.hasRegExpGroups1221221422612214226
URLPattern.hash9595142269514226
URLPattern.hostname9595142269514226
URLPattern.password9595142269514226
URLPattern.pathname9595142269514226
URLPattern.port9595142269514226
URLPattern.protocol9595142269514226
URLPattern.search9595142269514226
URLPattern.test9595142269514226
URLPattern.username9595142269514226