Web platform features explorer

URL.canParse()

Newly available since 2023-12-07
Tags: api

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

Usage (according to Chrome Platform Status)

~4.565% of page loads. More data at chromestatus.

Specifications