URL.parse(input[, base])
-
input
<string> 要解析的绝对或相对的输入网址。如果input
是相对的,则需要base
。如果input
是绝对的,则忽略base
。如果input
不是字符串,则首先是 转换为字符串。¥
input
<string> The absolute or relative input URL to parse. Ifinput
is relative, thenbase
is required. Ifinput
is absolute, thebase
is ignored. Ifinput
is not a string, it is converted to a string first. -
base
<string> 如果input
不是绝对的,则为要解析的基本网址。如果base
不是字符串,则首先是 转换为字符串。¥
base
<string> The base URL to resolve against if theinput
is not absolute. Ifbase
is not a string, it is converted to a string first.
将字符串解析为 URL。如果提供了 base
,它将被用作基本 URL,用于解析非绝对 input
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.