URL.canParse()
Newly available since 2023-12-07
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.
Learning resources on MDN
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
Specifications
- URL Standard (#dom-url-canparse), from URL Workstream (WHATWG).