值
字符串。
示例
js
const url = new URL(
"https://developer.mozilla.org/zh-CN/docs/Web/API/URL/href",
);
console.log(url.href); // 输出:'https://developer.mozilla.org/zh-CN/docs/Web/API/URL/href'
规范
| 规范 |
|---|
| URL> # dom-url-href> |
浏览器兼容性
参见
- 所属的
URL接口。