简体中文
外观
URL
toString()
toString() 方法返回完整的地址文本,和 href 相同。
href
无。
字符串,等于 href。
const u = new URL('https://a.com/x?y=1'); console.log(u.toString() === u.href, `${u}`);
结果:输出 true https://a.com/x?y=1。未在模拟器验证。
true https://a.com/x?y=1
和 Web 相同。
toJSON()