URL.toString()
URL.toString()
字符串化方法返回一个包含完整 URL 的 USVString
。它的作用等同于只读的 URL.href
。
备注: 此特性在 Web Worker 中可用
语法
string = url.toString();
参数
无。
返回值
一个USVString
。
参考
js
const url = new URL(
"https://developer.mozilla.org/zh-CN/docs/Web/API/URL/toString",
);
url.toString(); // 应当返回字符串形式的 URL
规范
Specification |
---|
URL Standard # URL-stringification-behavior |
浏览器兼容性
BCD tables only load in the browser
参见
- 父级接口
URL
。