URL.parse(input[, base])
input<string> 要解析的绝对或相对输入 URL。如果input是相对的,则需要base。如果input是绝对的,则忽略base。如果input不是字符串,则会先进行 转换为字符串。base<string> 如果input不是绝对路径,则用作解析的基础 URL。如果base不是字符串,则首先转为 转换为字符串。- 返回:<URL> | <null>
将字符串解析为 URL。如果提供了 base,它将被用作解析非绝对 input URL 的基础 URL。如果 input 无效,则返回 null。
🌐 Parses a string as a URL. If base is provided, it will be used as the base
URL for the purpose of resolving non-absolute input URLs. Returns null
if input is not a valid.