URL.canParse()
The URL.canParse()
static method checks whether a URL can be parsed into a valid URL
object. It's an alternative to calling new URL()
in a try … catch
statement.
Status
Baseline Newly Available (since 2023-12-07)
This feature is expected to reach Baseline Widely Available status on: 2026-06-07
MDN documentation
Specifications
- URL (#dom-url-canparse), from URL Workstream (WHATWG).
Browser support
- Chrome 120 Released on 2023-12-05
- Chrome Android 120 Released on 2023-12-05
- Edge 120 Released on 2023-12-07
- Firefox 115 Released on 2023-07-04
- Firefox for Android 115 Released on 2023-07-04
- Safari 17 Released on 2023-09-18
- Safari on iOS 17 Released on 2023-09-18
Usage (according to Chrome Platform Status)
~4.709% of page loads. More data at chromestatus.
Web Platform Tests (WPT)
View the latest WPT test results for this featureView as JSON | Edit this feature | Report an issue | Web-features entry: source, dist